Class NonReentrantLock.Sync
java.lang.Object
java.util.concurrent.locks.AbstractOwnableSynchronizer
java.util.concurrent.locks.AbstractQueuedSynchronizer
com.github.benmanes.caffeine.cache.NonReentrantLock.Sync
- All Implemented Interfaces:
Serializable
,Lock
- Enclosing class:
- NonReentrantLock
static final class NonReentrantLock.Sync
extends AbstractQueuedSynchronizer
implements Lock, Serializable
A non-fair lock using AQS state to represent if the lock is held.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
(package private) static final long
(package private) static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetOwner()
protected boolean
boolean
isLocked()
void
lock()
void
private void
protected boolean
tryAcquire
(int acquires) boolean
tryLock()
boolean
protected boolean
tryRelease
(int releases) void
unlock()
Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isQueued, owns, release, releaseShared, setState, toString, tryAcquireNanos, tryAcquireShared, tryAcquireSharedNanos, tryReleaseShared
Methods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer
getExclusiveOwnerThread, setExclusiveOwnerThread
-
Field Details
-
serialVersionUID
static final long serialVersionUID- See Also:
-
UNLOCKED
static final int UNLOCKED- See Also:
-
LOCKED
static final int LOCKED- See Also:
-
-
Constructor Details
-
Sync
Sync()
-
-
Method Details
-
lock
public void lock() -
lockInterruptibly
- Specified by:
lockInterruptibly
in interfaceLock
- Throws:
InterruptedException
-
tryLock
public boolean tryLock() -
tryLock
- Specified by:
tryLock
in interfaceLock
- Throws:
InterruptedException
-
unlock
public void unlock() -
newCondition
- Specified by:
newCondition
in interfaceLock
-
tryAcquire
protected boolean tryAcquire(int acquires) - Overrides:
tryAcquire
in classAbstractQueuedSynchronizer
-
tryRelease
protected boolean tryRelease(int releases) - Overrides:
tryRelease
in classAbstractQueuedSynchronizer
-
isHeldExclusively
protected boolean isHeldExclusively()- Overrides:
isHeldExclusively
in classAbstractQueuedSynchronizer
-
isLocked
public boolean isLocked() -
getOwner
-
readObject
- Throws:
IOException
ClassNotFoundException
-