2

Apache Lucene uses a modified form of the Brics automaton package. But is Brics thread safe?

More specifically, can it safely handle multiple, concurrent automaton instances from different threads - without blocking?

Community
  • 1
  • 1
Ashwin Jayaprakash
  • 2,168
  • 24
  • 29

2 Answers2

3

Yes, constructing an Automaton or a RunAutomaton from a RegExp is thread safe - unless you use setAllowMutate.

1

thread safety depends upon how you use it, but the way in which we use it doesn't need to be thread safe.

thats because automatonquery's constructor compiles everything to a totally immutable form internally.

Robert Muir
  • 3,185
  • 21
  • 17
  • 1
    I meant if the same compiled Automaton and then create multiple RunAutomaton instances - one in each thread and then run them concurrently? – Ashwin Jayaprakash Dec 08 '11 at 04:06