/** * Consume all the elements, will block if queue is empty * @param consumer the consumer callback object * @throws InterruptedException */ void consumeAll(Consumer<T> consumer) throws InterruptedException { waitForData(); try { for (int i = size(); i-- > 0; ) { consumer.consume(front()); // can take forever _dequeue(); } } finally { clearConsumerLock(); } }
/** * Consume all the elements, will block if queue is empty * @param consumer the consumer callback object * @throws InterruptedException */ void consumeAll(Consumer<T> consumer) throws InterruptedException { waitForData(); try { for (int i = size(); i-- > 0; ) { consumer.consume(front()); // can take forever _dequeue(); } } finally { clearConsumerLock(); } }
/** * Consume all the elements, will block if queue is empty * @param consumer the consumer callback object * @throws InterruptedException */ void consumeAll(Consumer<T> consumer) throws InterruptedException { waitForData(); try { for (int i = size(); i-- > 0; ) { consumer.consume(front()); // can take forever _dequeue(); } } finally { clearConsumerLock(); } }
/** * Consume one element, will block if queue is empty * Only one consumer at a time is allowed * @param consumer the consumer callback object */ void consume(Consumer<T> consumer) throws InterruptedException { T e = waitForData(); try { consumer.consume(e); // can take forever _dequeue(); } finally { clearConsumerLock(); } }
/** * Consume one element, will block if queue is empty * Only one consumer at a time is allowed * @param consumer the consumer callback object */ void consume(Consumer<T> consumer) throws InterruptedException { T e = waitForData(); try { consumer.consume(e); // can take forever _dequeue(); } finally { clearConsumerLock(); } }
/** * Consume one element, will block if queue is empty * Only one consumer at a time is allowed * @param consumer the consumer callback object */ void consume(Consumer<T> consumer) throws InterruptedException { T e = waitForData(); try { consumer.consume(e); // can take forever _dequeue(); } finally { clearConsumerLock(); } }
/** * Consume all the elements, will block if queue is empty * @param consumer the consumer callback object * @throws InterruptedException */ void consumeAll(Consumer<T> consumer) throws InterruptedException { waitForData(); try { for (int i = size(); i-- > 0; ) { consumer.consume(front()); // can take forever _dequeue(); } } finally { clearConsumerLock(); } }
/** * Consume one element, will block if queue is empty * Only one consumer at a time is allowed * @param consumer the consumer callback object */ void consume(Consumer<T> consumer) throws InterruptedException { T e = waitForData(); try { consumer.consume(e); // can take forever _dequeue(); } finally { clearConsumerLock(); } }
/** * Consume all the elements, will block if queue is empty * @param consumer the consumer callback object * @throws InterruptedException */ void consumeAll(Consumer<T> consumer) throws InterruptedException { waitForData(); try { for (int i = size(); i-- > 0; ) { consumer.consume(front()); // can take forever _dequeue(); } } finally { clearConsumerLock(); } }
/** * Consume one element, will block if queue is empty * Only one consumer at a time is allowed * @param consumer the consumer callback object */ void consume(Consumer<T> consumer) throws InterruptedException { T e = waitForData(); try { consumer.consume(e); // can take forever _dequeue(); } finally { clearConsumerLock(); } }