base/common/src/main/com/thesett/common/util/concurrent/BatchSynchQueueBase.java
public E take() throws InterruptedException
    {
        ReentrantLock lock = this.lock;
        lock.lockInterruptibly();

        try
        {
            try
            {
                while (count == 0)
                {
                    // Release the lock and wait until the queue becomes non-empty.
                    notEmpty.await();
                }
            }
            catch (InterruptedException ie)
            {
                notEmpty.signal(); // propagate to non-interrupted thread
                throw ie;
            }

            // There is data in the queue so extraction must succeed. Notify any waiting threads that the queue is
            // not full, and unblock the producer that owns the data item that is taken.
            return extract(true, true).getElement();
        }
        finally
        {
            lock.unlock();
        }
    }
public E take() throws InterruptedException
    {
        ReentrantLock lock = this.lock;
        lock.lockInterruptibly();

        try
        {
            try
            {
                while (count == 0)
                {
                    // Release the lock and wait until the queue becomes non-empty.
                    notEmpty.await();
                }
            }
            catch (InterruptedException ie)
            {
                notEmpty.signal(); // propagate to non-interrupted thread
                throw ie;
            }

            // There is data in the queue so extraction must succeed. Notify any waiting threads that the queue is
            // not full, and unblock the producer that owns the data item that is taken.
            return extract(true, true).getElement();
        }
        finally
        {
            lock.unlock();
        }
    }
public E take ( ) throws InterruptedException { ReentrantLock lock = this . lock ; lock . lockInterruptibly ( ) ; try { try { while ( count == 0 ) { // Release the lock and wait until the queue becomes non-empty. notEmpty . await ( ) ; } } catch ( InterruptedException ie ) { notEmpty . signal ( ) ; // propagate to non-interrupted thread throw ie ; } // There is data in the queue so extraction must succeed. Notify any waiting threads that the queue is // not full, and unblock the producer that owns the data item that is taken. return extract ( true , true ) . getElement ( ) ; } finally { lock . unlock ( ) ; } }
Retrieves and removes the head of this queue, waiting if no elements are present on this queue. Any producer that
has its data element taken by this call will be immediately unblocked. To keep the producer blocked whilst taking
just a single item, use the {@link #drainTo(java.util.Collection< SynchRecord <E>>, int, boolean)} method. There
is no take method to do that because there is not usually any advantage in a synchronous hand off design that
consumes data one item at a time. It is normal to consume data in chunks to ammortize consumption latencies
accross many producers where possible.

@return The head of this queue.

@throws InterruptedException if interrupted while waiting.
Retrieves and removes the head of this queue waiting if no elements are present on this queue . Any producer that has its data element taken by this call will be immediately unblocked . To keep the producer blocked whilst taking just a single item use the { @link #drainTo ( java . util . Collection< SynchRecord <E >> int boolean ) } method . There is no take method to do that because there is not usually any advantage in a synchronous hand off design that consumes data one item at a time . It is normal to consume data in chunks to ammortize consumption latencies accross many producers where possible .