@Override protected synchronized void waitWorkers() throws InterruptedException { if (buffer_.isEmpty()) // wake up blocked workers if not done already buffer_.offer(poison_pill_); super.waitWorkers(); // remove all poison pills while (buffer_.peek() == poison_pill_) { buffer_.remove(); } }
@Override protected synchronized void waitWorkers() throws InterruptedException { if (buffer_.isEmpty()) // wake up blocked workers if not done already buffer_.offer(poison_pill_); super.waitWorkers(); // remove all poison pills while (buffer_.peek() == poison_pill_) { buffer_.remove(); } }
@Override protected synchronized void waitWorkers() throws InterruptedException { if (buffer_.isEmpty()) // wake up blocked workers if not done already buffer_.offer(poison_pill_); super.waitWorkers(); // remove all poison pills while (buffer_.peek() == poison_pill_) { buffer_.remove(); } }
/** * Requests all workers to terminate when processing is finished. The method * blocks until all workers have been stopped. If interrupted while blocked, * this method can be called again in order to complete the termination * request. * * @throws InterruptedException * if interrupted during waiting for finish request */ public synchronized void finish() throws InterruptedException { termination = true; waitWorkers(); if (!isInterrupted()) { processorFactory.finish(); } }
/** * Requests all workers to terminate when processing is finished. The method * blocks until all workers have been stopped. If interrupted while blocked, * this method can be called again in order to complete the termination * request. * * @throws InterruptedException * if interrupted during waiting for finish request */ public synchronized void finish() throws InterruptedException { termination = true; waitWorkers(); if (!isInterrupted()) { processorFactory.finish(); } }
/** * Requests all workers to terminate when processing is finished. The method * blocks until all workers have been stopped. If interrupted while blocked, * this method can be called again in order to complete the termination * request. * * @throws InterruptedException * if interrupted during waiting for finish request */ public synchronized void finish() throws InterruptedException { termination = true; waitWorkers(); if (!isInterrupted()) { processorFactory.finish(); } }
/** * Marks the end of the input and requests all workers to terminate when all * currently submitted input has been processed. After calling this method, * no new input can be submitted anymore, i.e., calling * {@link #submit(Object)} will always return {@code false}. The method * blocks until all workers have been stopped. If interrupted while blocked, * this method can be called again in order to complete the termination * request. * * @throws InterruptedException * if interrupted during waiting for finish request */ public synchronized void finish() throws InterruptedException { termination_ = true; waitWorkers(); if (!isInterrupted()) { termination_ = false; inputProcessorFactory_.finish(); } }