Package com.saxonica.ee.parallel
Class CountingCompletionService<V>
java.lang.Object
java.util.concurrent.ExecutorCompletionService<V>
com.saxonica.ee.parallel.CountingCompletionService<V>
- All Implemented Interfaces:
CompletionService<V>
Extension of ExecutorCompletionService to count the number of tasks submitted
and take that many completed tasks before calling it a day.
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 Summary
ConstructorsConstructorDescriptionCountingCompletionService
(Executor executor) CountingCompletionService
(Executor executor, BlockingQueue<Future<V>> queue) -
Method Summary
-
Constructor Details
-
CountingCompletionService
-
CountingCompletionService
-
-
Method Details
-
submit
- Specified by:
submit
in interfaceCompletionService<V>
- Overrides:
submit
in classExecutorCompletionService<V>
-
submit
- Specified by:
submit
in interfaceCompletionService<V>
- Overrides:
submit
in classExecutorCompletionService<V>
-
take
- Specified by:
take
in interfaceCompletionService<V>
- Overrides:
take
in classExecutorCompletionService<V>
- Throws:
InterruptedException
-
poll
- Specified by:
poll
in interfaceCompletionService<V>
- Overrides:
poll
in classExecutorCompletionService<V>
-
poll
- Specified by:
poll
in interfaceCompletionService<V>
- Overrides:
poll
in classExecutorCompletionService<V>
- Throws:
InterruptedException
-
getNumberOfCompletedTasks
public long getNumberOfCompletedTasks() -
getNumberOfSubmittedTasks
public long getNumberOfSubmittedTasks() -
hasUncompletedTasks
public boolean hasUncompletedTasks()
-