Code example for ReentrantLock

Methods: newCondition

0
 
    /** Maximum number of items in the deque */ 
    private final int capacity;
 
    /** Main lock guarding all access */ 
    final ReentrantLock lock = new ReentrantLock();
 
    /** Condition for waiting takes */ 
    private final Condition notEmpty = lock.newCondition();
 
    /** Condition for waiting puts */ 
    private final Condition notFull = lock.newCondition();
 
    /** 
     * Creates a {@code LinkedBlockingDeque} with a capacity of 
     * {@link Integer#MAX_VALUE}. 
     */ 
    public LinkedBlockingDeque() { 
        this(Integer.MAX_VALUE);
    }