mirror of https://github.com/apache/lucene.git
Fix concurrency bug in DrillSidewaysQuery (#195)
This commit is contained in:
parent
9942d59f0d
commit
578f5cf51b
|
@ -19,6 +19,7 @@ package org.apache.lucene.facet;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -65,12 +66,15 @@ class DrillSidewaysQuery extends Query {
|
||||||
FacetsCollectorManager[] drillSidewaysCollectorManagers,
|
FacetsCollectorManager[] drillSidewaysCollectorManagers,
|
||||||
Query[] drillDownQueries,
|
Query[] drillDownQueries,
|
||||||
boolean scoreSubDocsAtOnce) {
|
boolean scoreSubDocsAtOnce) {
|
||||||
|
// Note that the "managed" facet collector lists are synchronized here since bulkScorer()
|
||||||
|
// can be invoked concurrently and needs to remain thread-safe. We're OK with synchronizing
|
||||||
|
// on the whole list as contention is expected to remain very low:
|
||||||
this(
|
this(
|
||||||
baseQuery,
|
baseQuery,
|
||||||
drillDownCollectorManager,
|
drillDownCollectorManager,
|
||||||
drillSidewaysCollectorManagers,
|
drillSidewaysCollectorManagers,
|
||||||
new ArrayList<>(),
|
Collections.synchronizedList(new ArrayList<>()),
|
||||||
new ArrayList<>(),
|
Collections.synchronizedList(new ArrayList<>()),
|
||||||
drillDownQueries,
|
drillDownQueries,
|
||||||
scoreSubDocsAtOnce);
|
scoreSubDocsAtOnce);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue