java.lang.Object
org.apache.lucene.search.TaskExecutor.TaskGroup<T>
- Type Parameters:
T
- the return type of all the callables
- Enclosing class:
TaskExecutor
Holds all the sub-tasks that a certain operation gets split into as it gets parallelized and
exposes the ability to invoke such tasks and wait for them all to complete their execution and
provide their results. Ensures that each task does not get parallelized further: this is
important to avoid a deadlock in situations where one executor thread waits on other executor
threads to complete before it can progress. This happens in situations where for instance
Query.createWeight(IndexSearcher, ScoreMode, float)
is called as part of searching each
slice, like TopFieldCollector.populateScores(ScoreDoc[], IndexSearcher, Query)
does.
Additionally, if one task throws an exception, all other tasks from the same group are
cancelled, to avoid needless computation as their results would not be exposed anyways. Creates
one FutureTask
for each Callable
provided-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
private void
(package private) RunnableFuture
<T> createTask
(Callable<T> callable)
-
Field Details
-
futures
-
-
Constructor Details
-
TaskGroup
TaskGroup(Collection<Callable<T>> callables)
-
-
Method Details
-
createTask
-
invokeAll
- Throws:
IOException
-
assertAllFuturesCompleted
private boolean assertAllFuturesCompleted() -
cancelAll
private void cancelAll()
-