public class OptimisticLockStamped extends Object implements OptimisticLock
StampedLock| Constructor and Description |
|---|
OptimisticLockStamped() |
| Modifier and Type | Method and Description |
|---|---|
long |
readLock()
Non-exclusively acquires the lock, blocking if necessary
until available.
|
long |
tryOptimisticRead()
Returns a stamp that can later be validated, or zero
if exclusively locked.
|
void |
unlockRead(long stamp)
If the lock state matches the given stamp, releases the
non-exclusive lock.
|
void |
unlockWrite(long stamp)
If the lock state matches the given stamp, releases the
exclusive lock.
|
boolean |
validate(long stamp)
Returns true if the lock has not been exclusively acquired
since issuance of the given stamp.
|
long |
writeLock()
Exclusively acquires the lock, blocking if necessary
until available.
|
public long readLock()
OptimisticLockreadLock in interface OptimisticLockpublic long writeLock()
OptimisticLockwriteLock in interface OptimisticLockpublic long tryOptimisticRead()
OptimisticLockOptimisticLock.unlockWrite(long) become visible.tryOptimisticRead in interface OptimisticLockpublic boolean validate(long stamp)
OptimisticLockOptimisticLock.tryOptimisticRead() or a locking method
for this lock has no defined effect or result.validate in interface OptimisticLockstamp - a stamptrue if the lock has not been exclusively acquired
since issuance of the given stamp; else falsepublic void unlockRead(long stamp)
OptimisticLockunlockRead in interface OptimisticLockstamp - a stamp returned by a read-lock operationpublic void unlockWrite(long stamp)
OptimisticLockunlockWrite in interface OptimisticLockstamp - a stamp returned by a write-lock operationcache2k API documentation. Copyright © 2000–2019 headissue GmbH, Munich.