A {@code ReentrantZkLock} is owned by the party (both the current thread and the running ZooKeeper client)which has last successfully locked it, but has not yet unlocked it. Parties invoking {@code lock} will return,successfully acquiring the lock, whenever the lock is not owned by another party. All methods will return immediate success if the current party is the lock owner. This can be checked by {@link #hasLock()}.
Note that this implementation is fully fair; multiple concurrent requests by different parties will be granted in order, where the ordering is determined by the ZooKeeper server.
This lock supports {@code Integer.MAX_VALUE} repeated locks by the same thread. Attempts to exceed this resultin overflows which can create an improper lock state. @author Scott Fines @version 1.0 @see java.util.concurrent.locks.ReentrantLock @deprecated Use {@link Locksmith.reentrantLock} factories to create a different (internal) lock instance instead.
|
|