public class CountingCompletionService<V> extends ExecutorCompletionService<V>
This is necessary because the base class, ExecutorCompletionService, does not provide any way of knowing how many results you need to read off before you know that you have read them all.
Constructor and Description |
---|
CountingCompletionService(Executor executor) |
CountingCompletionService(Executor executor,
BlockingQueue<Future<V>> queue) |
Modifier and Type | Method and Description |
---|---|
long |
getNumberOfCompletedTasks() |
long |
getNumberOfSubmittedTasks() |
boolean |
hasUncompletedTasks() |
Future<V> |
poll() |
Future<V> |
poll(long timeout,
TimeUnit unit) |
Future<V> |
submit(Callable<V> task) |
Future<V> |
submit(Runnable task,
V result) |
Future<V> |
take() |
public CountingCompletionService(Executor executor)
public CountingCompletionService(Executor executor, BlockingQueue<Future<V>> queue)
public Future<V> submit(Callable<V> task)
submit
in interface CompletionService<V>
submit
in class ExecutorCompletionService<V>
public Future<V> submit(Runnable task, V result)
submit
in interface CompletionService<V>
submit
in class ExecutorCompletionService<V>
public Future<V> take() throws InterruptedException
take
in interface CompletionService<V>
take
in class ExecutorCompletionService<V>
InterruptedException
public Future<V> poll()
poll
in interface CompletionService<V>
poll
in class ExecutorCompletionService<V>
public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException
poll
in interface CompletionService<V>
poll
in class ExecutorCompletionService<V>
InterruptedException
public long getNumberOfCompletedTasks()
public long getNumberOfSubmittedTasks()
public boolean hasUncompletedTasks()
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.