AsyncReadWriteLock
, AsyncStampedLock
public class FairAsyncStampedLock extends FairAsyncReadWriteLock implements AsyncStampedLock
AsyncStampedLock
implementation which provides fair ordering of acquisitions, like
that of FairAsyncReadWriteLock
. The tryOptimisticRead()
method also employs fair
ordering, in that a stamp will not be issued if there are queued writers waiting to acquire the
lock. Validation
of an already issued stamp, however, does not abide by
this ordering; it will only fail validation once a writer has successfully acquired the lock
(irrespective of queued writers)AsyncReadWriteLock.ReadLockToken, AsyncReadWriteLock.WriteLockToken
AsyncStampedLock.Stamp
Constructor | Description |
---|---|
FairAsyncStampedLock() |
Modifier and Type | Method | Description |
---|---|---|
AsyncStampedLock.Stamp |
tryOptimisticRead() |
Attempts to acquire a
AsyncStampedLock.Stamp in optimistic-read mode if the lock is not already
write-locked. |
acquireReadLock, acquireWriteLock, tryReadLock, tryWriteLock
create, createFair
acquireReadLock, acquireWriteLock, tryReadLock, tryWriteLock
public AsyncStampedLock.Stamp tryOptimisticRead()
AsyncStampedLock
AsyncStampedLock.Stamp
in optimistic-read mode if the lock is not already
write-locked. The stamp may subsequently be validated
to check whether
the write lock has been acquiredtryOptimisticRead
in interface AsyncStampedLock
null
Copyright © 2018. All rights reserved.