public class ZkLock
extends java.lang.Object
| Constructor and Description |
|---|
ZkLock(ZkConnection zk,
java.lang.String lockRootNodePath) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLockStillValid()
Can be called by a client to find out if the acquired lock is still valid.
|
boolean |
tryLock()
Acquires the lock only if it is free at the time of invocation.
|
void |
unlock()
Releases the lock.
|
public ZkLock(ZkConnection zk, java.lang.String lockRootNodePath)
zk - zookeeper connectionlockRootNodePath - zookeeper node where to set the lockpublic boolean tryLock()
public void unlock()
public boolean isLockStillValid()