AntiPattern
Keystore Stream Leaks
keystore-stream-leak-too-many-open-files
As long as you lock more than a single thing at a time, you risk deadlocks. — lock more than a single thing at a time. Tension: You hold B waiting for A, they hold A waiting for B. Outcome: one of you has to abort or you're stuck. | You hold B waiting for A, they hold A waiting for B — lock more than a single thing at a time. Tension: one of you has to abort or you're stuck. Outcome: deadlocks. | At the time of item selection, you neither lock them nor check whether they're locked. Tension: someone else could've already grabbed a subset of those. Outcome: the outer update requests a lock and at that point, someone else could've already grabbed a subset of those.