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:
submitin interfaceCompletionService<V>- Overrides:
submitin classExecutorCompletionService<V>
-
submit
- Specified by:
submitin interfaceCompletionService<V>- Overrides:
submitin classExecutorCompletionService<V>
-
take
- Specified by:
takein interfaceCompletionService<V>- Overrides:
takein classExecutorCompletionService<V>- Throws:
InterruptedException
-
poll
- Specified by:
pollin interfaceCompletionService<V>- Overrides:
pollin classExecutorCompletionService<V>
-
poll
- Specified by:
pollin interfaceCompletionService<V>- Overrides:
pollin classExecutorCompletionService<V>- Throws:
InterruptedException
-
getNumberOfCompletedTasks
public long getNumberOfCompletedTasks() -
getNumberOfSubmittedTasks
public long getNumberOfSubmittedTasks() -
hasUncompletedTasks
public boolean hasUncompletedTasks()
-