Package one.nio.lock

Class RWLock

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    FairRWLock, PaddedRWLock

    public class RWLock
    extends java.util.concurrent.locks.AbstractQueuedSynchronizer
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer

        java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long MILLIS  
      private static int READ  
      private static int WRITE  
    • Constructor Summary

      Constructors 
      Constructor Description
      RWLock()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void downgrade()  
      RWLock lockRead()  
      boolean lockRead​(long timeout)  
      RWLock lockWrite()  
      boolean lockWrite​(long timeout)  
      protected int tryAcquireShared​(int acquires)  
      protected boolean tryReleaseShared​(int releases)  
      void unlock​(boolean write)  
      void unlockRead()  
      void unlockWrite()  
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RWLock

        public RWLock()
    • 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:
        tryAcquireShared in class java.util.concurrent.locks.AbstractQueuedSynchronizer
      • tryReleaseShared

        protected final boolean tryReleaseShared​(int releases)
        Overrides:
        tryReleaseShared in class java.util.concurrent.locks.AbstractQueuedSynchronizer