Package one.nio.lock
Class RWLock
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FairRWLock,PaddedRWLock
public class RWLock extends AbstractQueuedSynchronizer
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject
-
-
Constructor Summary
Constructors Constructor Description RWLock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddowngrade()RWLocklockRead()booleanlockRead(long timeout)RWLocklockWrite()booleanlockWrite(long timeout)protected inttryAcquireShared(int acquires)protected booleantryReleaseShared(int releases)voidunlock(boolean write)voidunlockRead()voidunlockWrite()-
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, isHeldExclusively, isQueued, owns, release, releaseShared, setState, toString, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryRelease
-
Methods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer
getExclusiveOwnerThread, setExclusiveOwnerThread
-
-
-
-
Method Detail
-
lockRead
public final RWLock lockRead()
-
lockRead
public final boolean lockRead(long timeout)
-
unlockRead
public final void unlockRead()
-
lockWrite
public final RWLock lockWrite()
-
lockWrite
public final boolean lockWrite(long timeout)
-
unlockWrite
public final void unlockWrite()
-
unlock
public final void unlock(boolean write)
-
downgrade
public final void downgrade()
-
tryAcquireShared
protected int tryAcquireShared(int acquires)
- Overrides:
tryAcquireSharedin classAbstractQueuedSynchronizer
-
tryReleaseShared
protected final boolean tryReleaseShared(int releases)
- Overrides:
tryReleaseSharedin classAbstractQueuedSynchronizer
-
-