| Constructor and Description |
|---|
ZookeeperLock(ZookeeperConnection zookeeper,
String lockPath) |
| Modifier and Type | Method and Description |
|---|---|
String |
getLockPath() |
void |
lock()
Acquires the lock.
|
void |
lockInterruptibly() |
Condition |
newCondition() |
boolean |
tryLock()
Acquire the lock if it is available within 1 second of calling.
|
boolean |
tryLock(long time,
TimeUnit unit)
Acquire the lock if it is available within using .
|
void |
unlock() |
public ZookeeperLock(ZookeeperConnection zookeeper, String lockPath)
public void lock()
InterProcessSemaphoreMutex.acquire() for more information.lock in interface LockGraknBackendException - when there are Zookeeper connection issues.public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedExceptionpublic boolean tryLock()
public boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
tryLock in interface Locktime - amount of time to wait for the lock to be availableunit - unit of time that qualifies amount of time to wait for locktrue if the lock was acquired and
false otherwiseInterruptedExceptionpublic void unlock()
unlock in interface LockGraknBackendException - when there are Zookeeper connection issues.public Condition newCondition()
newCondition in interface Lockpublic String getLockPath()
Copyright © 2017 Grakn Labs Ltd. All rights reserved.