There is no additional delay. A method call returns if the item is available or the thread is interrupted.
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available. Returns: the head of this queue Throws: InterruptedException - if interrupted while waiting
BlockinQueue does this automatically (impl. Of ArrayBlockingQueue ).
// in add etc. notEmpty.signal(); // in take() while(count == 0) notEmpty.await();
source share