Class InterruptibleReentrantLock

  • All Implemented Interfaces:
    java.io.Serializable, java.util.concurrent.locks.Lock

    class InterruptibleReentrantLock
    extends java.util.concurrent.locks.ReentrantLock
    This sub-class was created to expose the waiting threads so that they can be interrupted when the pool using the queue that uses this lock is closed. The class is intended for internal use only.

    This class is intended to be thread-safe.

    Since:
    2.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Constructor Description
      InterruptibleReentrantLock​(boolean fairness)
      Create a new InterruptibleReentrantLock with the given fairness policy.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void interruptWaiters​(java.util.concurrent.locks.Condition condition)
      Interrupt the threads that are waiting on a specific condition
      • Methods inherited from class java.util.concurrent.locks.ReentrantLock

        getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, toString, tryLock, tryLock, unlock
      • Methods inherited from class java.lang.Object

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

      • InterruptibleReentrantLock

        public InterruptibleReentrantLock​(boolean fairness)
        Create a new InterruptibleReentrantLock with the given fairness policy.
        Parameters:
        fairness - true means threads should acquire contended locks as if waiting in a FIFO queue
    • Method Detail

      • interruptWaiters

        public void interruptWaiters​(java.util.concurrent.locks.Condition condition)
        Interrupt the threads that are waiting on a specific condition
        Parameters:
        condition - the condition on which the threads are waiting.