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:
java.io.Serializable
,java.util.concurrent.locks.Lock
- Enclosing class:
- NonReentrantLock
static final class NonReentrantLock.Sync extends java.util.concurrent.locks.AbstractQueuedSynchronizer implements java.util.concurrent.locks.Lock, java.io.Serializable
A non-fair lock using AQS state to represent if the lock is held.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
LOCKED
(package private) static long
serialVersionUID
(package private) static int
UNLOCKED
-
Constructor Summary
Constructors Constructor Description Sync()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Thread
getOwner()
protected boolean
isHeldExclusively()
boolean
isLocked()
void
lock()
void
lockInterruptibly()
java.util.concurrent.locks.Condition
newCondition()
private void
readObject(java.io.ObjectInputStream s)
protected boolean
tryAcquire(int acquires)
boolean
tryLock()
boolean
tryLock(long time, java.util.concurrent.TimeUnit unit)
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
-
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
UNLOCKED
static final int UNLOCKED
- See Also:
- Constant Field Values
-
LOCKED
static final int LOCKED
- See Also:
- Constant Field Values
-
-
Method Detail
-
lock
public void lock()
- Specified by:
lock
in interfacejava.util.concurrent.locks.Lock
-
lockInterruptibly
public void lockInterruptibly() throws java.lang.InterruptedException
- Specified by:
lockInterruptibly
in interfacejava.util.concurrent.locks.Lock
- Throws:
java.lang.InterruptedException
-
tryLock
public boolean tryLock()
- Specified by:
tryLock
in interfacejava.util.concurrent.locks.Lock
-
tryLock
public boolean tryLock(long time, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
tryLock
in interfacejava.util.concurrent.locks.Lock
- Throws:
java.lang.InterruptedException
-
unlock
public void unlock()
- Specified by:
unlock
in interfacejava.util.concurrent.locks.Lock
-
newCondition
public java.util.concurrent.locks.Condition newCondition()
- Specified by:
newCondition
in interfacejava.util.concurrent.locks.Lock
-
tryAcquire
protected boolean tryAcquire(int acquires)
- Overrides:
tryAcquire
in classjava.util.concurrent.locks.AbstractQueuedSynchronizer
-
tryRelease
protected boolean tryRelease(int releases)
- Overrides:
tryRelease
in classjava.util.concurrent.locks.AbstractQueuedSynchronizer
-
isHeldExclusively
protected boolean isHeldExclusively()
- Overrides:
isHeldExclusively
in classjava.util.concurrent.locks.AbstractQueuedSynchronizer
-
isLocked
public boolean isLocked()
-
getOwner
public java.lang.Thread getOwner()
-
readObject
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
-