public class ZooKeeperLock extends Object implements Lock
The method used is inspired by the queueing algorithm suggested in the ZooKeeper documentation.
| Modifier and Type | Class and Description |
|---|---|
static class |
ZooKeeperLock.State
Internal state of this lock.
|
| Modifier and Type | Field and Description |
|---|---|
protected ZooKeeperLock.State |
state |
| Modifier and Type | Method and Description |
|---|---|
void |
lock() |
void |
lockInterruptibly() |
Condition |
newCondition() |
boolean |
tryLock() |
boolean |
tryLock(long time,
TimeUnit unit) |
void |
unlock() |
protected ZooKeeperLock.State state
public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedExceptionpublic boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
tryLock in interface LockInterruptedExceptionpublic Condition newCondition()
newCondition in interface LockCopyright © 2015–2018 Lable. All rights reserved.