org.apache.accumulo.fate.zookeeper
public class ZooLock extends Object implements org.apache.zookeeper.Watcher
| Modifier and Type | Class and Description |
|---|---|
static interface |
ZooLock.AsyncLockWatcher |
static class |
ZooLock.LockLossReason |
static interface |
ZooLock.LockWatcher |
| Modifier and Type | Field and Description |
|---|---|
static String |
LOCK_PREFIX |
protected static org.apache.log4j.Logger |
log |
protected IZooReaderWriter |
zooKeeper |
| Modifier | Constructor and Description |
|---|---|
|
ZooLock(String zookeepers,
int timeInMillis,
String scheme,
byte[] auth,
String path) |
protected |
ZooLock(ZooCache zc,
IZooReaderWriter zrw,
String path) |
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteLock(IZooReaderWriter zk,
String path) |
static boolean |
deleteLock(IZooReaderWriter zk,
String path,
String lockData) |
static byte[] |
getLockData(ZooCache zc,
String path,
org.apache.zookeeper.data.Stat stat) |
static byte[] |
getLockData(org.apache.zookeeper.ZooKeeper zk,
String path) |
ZooUtil.LockID |
getLockID() |
String |
getLockName() |
String |
getLockPath() |
long |
getSessionId() |
static long |
getSessionId(ZooCache zc,
String path) |
boolean |
isLocked() |
static boolean |
isLockHeld(ZooCache zc,
ZooUtil.LockID lid) |
static boolean |
isLockHeld(org.apache.zookeeper.ZooKeeper zk,
ZooUtil.LockID lid) |
void |
lockAsync(ZooLock.AsyncLockWatcher lw,
byte[] data) |
void |
process(org.apache.zookeeper.WatchedEvent event) |
void |
replaceLockData(byte[] b) |
boolean |
tryLock(ZooLock.LockWatcher lw,
byte[] data) |
boolean |
tryToCancelAsyncLockOrUnlock() |
void |
unlock() |
boolean |
wasLockAcquired()
indicates if the lock was acquired in the past....
|
protected static final org.apache.log4j.Logger log
public static final String LOCK_PREFIX
protected final IZooReaderWriter zooKeeper
public ZooLock(String zookeepers, int timeInMillis, String scheme, byte[] auth, String path)
protected ZooLock(ZooCache zc, IZooReaderWriter zrw, String path)
public boolean tryLock(ZooLock.LockWatcher lw, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void lockAsync(ZooLock.AsyncLockWatcher lw, byte[] data)
public boolean tryToCancelAsyncLockOrUnlock()
throws InterruptedException,
org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic void unlock()
throws InterruptedException,
org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic String getLockPath()
public String getLockName()
public ZooUtil.LockID getLockID()
public boolean wasLockAcquired()
public boolean isLocked()
public void replaceLockData(byte[] b)
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void process(org.apache.zookeeper.WatchedEvent event)
process in interface org.apache.zookeeper.Watcherpublic static boolean isLockHeld(org.apache.zookeeper.ZooKeeper zk,
ZooUtil.LockID lid)
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic static boolean isLockHeld(ZooCache zc, ZooUtil.LockID lid)
public static byte[] getLockData(org.apache.zookeeper.ZooKeeper zk,
String path)
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic static byte[] getLockData(ZooCache zc, String path, org.apache.zookeeper.data.Stat stat)
public static long getSessionId(ZooCache zc, String path) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic long getSessionId()
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic static void deleteLock(IZooReaderWriter zk, String path) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic static boolean deleteLock(IZooReaderWriter zk, String path, String lockData) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionCopyright © 2014 Apache Accumulo Project. All Rights Reserved.