public class ManagedExecutorCompletionService<V> extends Object implements TaskDoneCallback
Constructor and Description |
---|
ManagedExecutorCompletionService(AbstractManagedExecutorService executor)
Creates an ExecutorCompletionService using the supplied
executor for base task execution and a
LinkedBlockingQueue as a completion queue. |
ManagedExecutorCompletionService(AbstractManagedExecutorService executor,
BlockingQueue<Future<V>> completionQueue)
Creates an ExecutorCompletionService using the supplied
executor for base task execution and the supplied queue as its
completion queue.
|
Modifier and Type | Method and Description |
---|---|
Future<V> |
poll() |
Future<V> |
poll(long timeout,
TimeUnit unit) |
Future<V> |
submit(Callable<V> task) |
Future<V> |
submit(Runnable task,
V result,
javax.enterprise.concurrent.ManagedTaskListener taskListener) |
Future<V> |
take() |
void |
taskDone(ManagedFutureTask future) |
public ManagedExecutorCompletionService(AbstractManagedExecutorService executor)
LinkedBlockingQueue
as a completion queue.executor
- the executor to useNullPointerException
- if executor is null
public ManagedExecutorCompletionService(AbstractManagedExecutorService 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 taskes cause
them not to be retrievable.NullPointerException
- if executor or completionQueue are null
public Future<V> submit(Runnable task, V result, javax.enterprise.concurrent.ManagedTaskListener taskListener)
public Future<V> take() throws InterruptedException
InterruptedException
public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException
InterruptedException
public void taskDone(ManagedFutureTask future)
taskDone
in interface TaskDoneCallback
Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.