public class NonReentrantMutex extends Object implements InterProcessTxLock
| Constructor and Description |
|---|
NonReentrantMutex(org.apache.curator.framework.CuratorFramework client,
String path) |
NonReentrantMutex(org.apache.curator.framework.CuratorFramework client,
String path,
org.apache.curator.framework.recipes.locks.LockInternalsDriver driver) |
| Modifier and Type | Method and Description |
|---|---|
void |
acquire(UUID theTxId)
Acquire the mutex - blocking until it's available.
|
boolean |
acquire(UUID theTxId,
long theTime,
TimeUnit theTimeUnit)
Acquire the mutex - blocks until it's available or the given time expires.
|
protected byte[] |
getLockNodeBytes() |
Collection<String> |
getParticipantNodes()
Return a sorted list of all current nodes participating in the lock
|
boolean |
isAcquired(UUID theTxId) |
boolean |
isAcquiredByAny() |
void |
release(UUID theTxId)
Release a lock for a transaction.
|
void |
releaseAll()
Release all locks for all transactions that we've created.
|
public NonReentrantMutex(org.apache.curator.framework.CuratorFramework client,
String path)
client - clientpath - the path to lockpublic NonReentrantMutex(org.apache.curator.framework.CuratorFramework client,
String path,
org.apache.curator.framework.recipes.locks.LockInternalsDriver driver)
client - clientpath - the path to lockdriver - lock driverpublic void acquire(UUID theTxId) throws Exception
release(UUID)acquire in interface InterProcessTxLockException - ZK errors, connection interruptionspublic boolean acquire(UUID theTxId, long theTime, TimeUnit theTimeUnit) throws Exception
release(UUID)acquire in interface InterProcessTxLocktheTime - time to waittheTimeUnit - time unitException - ZK errors, connection interruptionspublic boolean isAcquiredByAny()
throws IOException
isAcquiredByAny in interface InterProcessTxLockIOExceptionpublic boolean isAcquired(UUID theTxId)
isAcquired in interface InterProcessTxLocktheTxId - public void releaseAll()
throws Exception
releaseAll in interface InterProcessTxLockExceptionpublic void release(UUID theTxId) throws Exception
InterProcessTxLockrelease in interface InterProcessTxLockExceptionpublic Collection<String> getParticipantNodes() throws IOException
IOException - ZK errors, interruptions, etc.protected byte[] getLockNodeBytes()
Copyright © 2010-2016 Stardog Union. All Rights Reserved.