public class SequenceLock extends Object implements OptimisticLock
| Constructor and Description |
|---|
SequenceLock() |
| Modifier and Type | Method and Description |
|---|---|
long |
readLock()
Aquire a lock token for reading
|
boolean |
readLockHeld(long lockToken)
check if optimistic locking succeeded
|
long |
tryWriteLock() |
long |
tryWriteLock(long time,
TimeUnit unit) |
long |
tryWriteLockInterruptibly() |
void |
unlock(long sequence)
"commit" or unlock the sequence when the write lock is held
|
long |
writeLock()
Acquire the lock for writing, waiting if needed
|
public long readLock()
OptimisticLockreadLock in interface OptimisticLockpublic boolean readLockHeld(long lockToken)
OptimisticLockreadLockHeld in interface OptimisticLocklockToken - - the value returned from tryLockpublic long writeLock()
OptimisticLockwriteLock in interface OptimisticLockpublic void unlock(long sequence)
OptimisticLockunlock in interface OptimisticLocksequence - - lock sequence to unlockpublic long tryWriteLock()
tryWriteLock in interface OptimisticLockpublic long tryWriteLock(long time,
TimeUnit unit)
throws InterruptedException
tryWriteLock in interface OptimisticLockInterruptedException - on interruptpublic long tryWriteLockInterruptibly()
throws InterruptedException
tryWriteLockInterruptibly in interface OptimisticLockInterruptedException - - on interruptCopyright © 2012–2018 Conversant Engineering. All rights reserved.