How to acquire a lock by a key
Guava has something like this being released in 13.0; you can get it out of HEAD if you like. Striped<Lock> more or less allocates a specific number of locks, and then assigns strings to locks based on their hash code. The API looks more or less like Striped<Lock> locks = Striped.lock(stripes); Lock l = locks.get(string); … Read more