Class TaskExecutor.TaskGroup<T>

java.lang.Object
org.apache.lucene.search.TaskExecutor.TaskGroup<T>
Type Parameters:
T - the return type of all the callables
Enclosing class:
TaskExecutor

private static final class TaskExecutor.TaskGroup<T> extends Object
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