/** * Creates a <tt>SynchronousQueue</tt> with specified fairness policy. * @param fair if true, threads contend in FIFO order for access; * otherwise the order is unspecified. */ public SynchronousQueue(boolean fair) { if (fair) { qlock = new ReentrantLock(true); waitingProducers = new FifoWaitQueue(); waitingConsumers = new FifoWaitQueue(); } else { qlock = new ReentrantLock(); waitingProducers = new LifoWaitQueue(); waitingConsumers = new LifoWaitQueue(); } }
/** * Creates a <tt>SynchronousQueue</tt> with specified fairness policy. * @param fair if true, threads contend in FIFO order for access; * otherwise the order is unspecified. */ public SynchronousQueue(boolean fair) { if (fair) { qlock = new ReentrantLock(true); waitingProducers = new FifoWaitQueue(); waitingConsumers = new FifoWaitQueue(); } else { qlock = new ReentrantLock(); waitingProducers = new LifoWaitQueue(); waitingConsumers = new LifoWaitQueue(); } }
/** * Creates a <tt>SynchronousQueue</tt> with specified fairness policy. * @param fair if true, threads contend in FIFO order for access; * otherwise the order is unspecified. */ public SynchronousQueue(boolean fair) { if (fair) { qlock = new ReentrantLock(true); waitingProducers = new FifoWaitQueue(); waitingConsumers = new FifoWaitQueue(); } else { qlock = new ReentrantLock(); waitingProducers = new LifoWaitQueue(); waitingConsumers = new LifoWaitQueue(); } }