Package org.aksw.commons.util.concurrent
Class CountingCompletionService<V>
- java.lang.Object
-
- java.util.concurrent.ExecutorCompletionService<V>
-
- org.aksw.commons.util.concurrent.CountingCompletionService<V>
-
- Type Parameters:
V-
- All Implemented Interfaces:
CompletionService<V>
public class CountingCompletionService<V> extends ExecutorCompletionService<V>
Source: http://stackoverflow.com/questions/9987019/how-to-know-when-a-completionservice-is-finished-delivering-results http://www.javaspecialists.eu/archive/Issue214.html- Author:
- raven
-
-
Constructor Summary
Constructors Constructor Description CountingCompletionService(Executor executor)CountingCompletionService(Executor executor, BlockingQueue<Future<V>> queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetNumberOfCompletedTasks()longgetNumberOfSubmittedTasks()booleanhasUncompletedTasks()Future<V>poll()Future<V>poll(long timeout, TimeUnit unit)Future<V>submit(Runnable task, V result)Future<V>submit(Callable<V> task)Future<V>take()
-
-
-
Constructor Detail
-
CountingCompletionService
public CountingCompletionService(Executor executor)
-
CountingCompletionService
public CountingCompletionService(Executor executor, BlockingQueue<Future<V>> queue)
-
-
Method Detail
-
submit
public Future<V> submit(Callable<V> task)
- Specified by:
submitin interfaceCompletionService<V>- Overrides:
submitin classExecutorCompletionService<V>
-
submit
public Future<V> submit(Runnable task, V result)
- Specified by:
submitin interfaceCompletionService<V>- Overrides:
submitin classExecutorCompletionService<V>
-
take
public Future<V> take() throws InterruptedException
- Specified by:
takein interfaceCompletionService<V>- Overrides:
takein classExecutorCompletionService<V>- Throws:
InterruptedException
-
poll
public Future<V> poll()
- Specified by:
pollin interfaceCompletionService<V>- Overrides:
pollin classExecutorCompletionService<V>
-
poll
public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
pollin interfaceCompletionService<V>- Overrides:
pollin classExecutorCompletionService<V>- Throws:
InterruptedException
-
getNumberOfCompletedTasks
public long getNumberOfCompletedTasks()
-
getNumberOfSubmittedTasks
public long getNumberOfSubmittedTasks()
-
hasUncompletedTasks
public boolean hasUncompletedTasks()
-
-