mirror of https://github.com/apache/lucene.git
Make compileAutomaton synchronized, as it can break for queries that are shared constants (like a drop down list in a web interface that provides predefined query constraints. These types of queries are in most places somewhere predefined in your code and then used by different threads/servlets/whatever). As the three transient vars cannot be set atomically, a parallel running thread may see half of the fields assigned and will get NPE).
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@987118 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cbc4a3a1cf
commit
64bdf38619
|
@ -75,7 +75,8 @@ public class AutomatonQuery extends MultiTermQuery {
|
|||
MinimizationOperations.minimize(automaton);
|
||||
}
|
||||
|
||||
private void compileAutomaton() {
|
||||
private synchronized void compileAutomaton() {
|
||||
// this method must be synchronized, as setting the three transient fields is not atomic:
|
||||
if (runAutomaton == null) {
|
||||
runAutomaton = new ByteRunAutomaton(automaton);
|
||||
isFinite = SpecialOperations.isFinite(automaton);
|
||||
|
|
Loading…
Reference in New Issue