java.util.concurrent.locks
Class ReentrantLock.FairSync
java.lang.Object
java.util.concurrent.locks.AbstractQueuedSynchronizer
java.util.concurrent.locks.ReentrantLock.Sync
java.util.concurrent.locks.ReentrantLock.FairSync
- All Implemented Interfaces:
- Serializable
- Enclosing class:
- ReentrantLock
static final class ReentrantLock.FairSync
- extends ReentrantLock.Sync
Sync object for fair locks
|
Method Summary |
(package private) void |
lock()
Perform Lock.lock(). |
protected boolean |
tryAcquire(int acquires)
Fair version of tryAcquire. |
| Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer |
acquire, acquireInterruptibly, acquireQueued, acquireShared, acquireSharedInterruptibly, compareAndSetState, fullyRelease, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedThreads, hasWaiters, isOnSyncQueue, isQueued, owns, release, releaseShared, setState, toString, transferAfterCancelledWait, transferForSignal, tryAcquireNanos, tryAcquireShared, tryAcquireSharedNanos, tryReleaseShared |
ReentrantLock.FairSync
ReentrantLock.FairSync()
lock
final void lock()
- Description copied from class:
ReentrantLock.Sync
- Perform
Lock.lock(). The main reason for subclassing
is to allow fast path for nonfair version.
- Specified by:
lock in class ReentrantLock.Sync
tryAcquire
protected final boolean tryAcquire(int acquires)
- Fair version of tryAcquire. Don't grant access unless
recursive call or no waiters or is first.
- Overrides:
tryAcquire in class AbstractQueuedSynchronizer
- Parameters:
acquires - the acquire argument. This value
is always the one passed to an acquire method,
or is the value saved on entry to a condition wait.
The value is otherwise uninterpreted and can represent anything
you like.
- Returns:
- true if successful. Upon success, this object has been
acquired.
Please submit a feedback, bug or feature