Class NonFairReentrantLock

  • All Implemented Interfaces:
    java.io.Serializable, java.util.concurrent.locks.Lock
    Direct Known Subclasses:
    DelegableReentrantLock

    public class NonFairReentrantLock
    extends java.lang.Object
    implements java.util.concurrent.locks.Lock, java.io.Serializable
    Since:
    3.6
    Author:
    Eike Stepper
    See Also:
    Serialized Form
    • Constructor Detail

      • NonFairReentrantLock

        public NonFairReentrantLock()
    • Method Detail

      • lock

        public void lock()
        Specified by:
        lock in interface java.util.concurrent.locks.Lock
      • lockInterruptibly

        public void lockInterruptibly()
                               throws java.lang.InterruptedException
        Specified by:
        lockInterruptibly in interface java.util.concurrent.locks.Lock
        Throws:
        java.lang.InterruptedException
      • tryLock

        public boolean tryLock()
        Specified by:
        tryLock in interface java.util.concurrent.locks.Lock
      • tryLock

        public boolean tryLock​(long timeout,
                               java.util.concurrent.TimeUnit unit)
                        throws java.lang.InterruptedException
        Specified by:
        tryLock in interface java.util.concurrent.locks.Lock
        Throws:
        java.lang.InterruptedException
      • unlock

        public void unlock()
        Specified by:
        unlock in interface java.util.concurrent.locks.Lock
      • newCondition

        public java.util.concurrent.locks.Condition newCondition()
        Specified by:
        newCondition in interface java.util.concurrent.locks.Lock
      • getHoldCount

        public int getHoldCount()
      • isHeldByCurrentThread

        public boolean isHeldByCurrentThread()
      • isLocked

        public boolean isLocked()
      • getOwner

        public java.lang.Thread getOwner()
      • hasQueuedThreads

        public final boolean hasQueuedThreads()
      • hasQueuedThread

        public final boolean hasQueuedThread​(java.lang.Thread thread)
      • getQueueLength

        public final int getQueueLength()
      • hasWaiters

        public boolean hasWaiters​(java.util.concurrent.locks.Condition condition)
      • getWaitQueueLength

        public int getWaitQueueLength​(java.util.concurrent.locks.Condition condition)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getQueuedThreads

        protected java.util.Collection<java.lang.Thread> getQueuedThreads()
      • getWaitingThreads

        protected java.util.Collection<java.lang.Thread> getWaitingThreads​(java.util.concurrent.locks.Condition condition)
      • isOwner

        protected boolean isOwner​(java.lang.Thread thread,
                                  java.lang.Thread owner)