public class ExecutorCompletionService<T,V> extends Object implements CompletionService<V>
| Constructor and Description |
|---|
ExecutorCompletionService(Executor executor)
Creates an ExecutorCompletionService using the supplied
executor for base task execution and a
LinkedBlockingQueue as a completion queue. |
ExecutorCompletionService(Executor executor,
BlockingQueue<Future<V>> completionQueue)
Creates an ExecutorCompletionService using the supplied
executor for base task execution and the supplied queue as its
completion queue.
|
public ExecutorCompletionService(Executor executor)
LinkedBlockingQueue as a completion queue.executor - the executor to useNullPointerException - if executor is nullpublic ExecutorCompletionService(Executor executor, BlockingQueue<Future<V>> completionQueue)
executor - the executor to usecompletionQueue - the queue to use as the completion queue
normally one dedicated for use by this service. This
queue is treated as unbounded -- failed attempted
Queue.add operations for completed tasks cause
them not to be retrievable.NullPointerException - if executor or completionQueue are nullpublic Future<V> submit(Callable<V> task)
submit in interface CompletionService<V>public Future<V> submit(Runnable task, V result)
submit in interface CompletionService<V>public Future<V> take() throws InterruptedException
take in interface CompletionService<V>InterruptedExceptionpublic Future<V> poll()
poll in interface CompletionService<V>public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException
poll in interface CompletionService<V>InterruptedExceptionCopyright © 2016–2021 Dexecutor. All rights reserved.