On 7/6/11 4:32 PM, Jason Baldridge wrote:
So the core components (e.g. sentence detector, tokenizer) are not
thread-safe due to poor encapsulation. I seem to recall this being discussed
before, but can't remember. Regardless, I think this would be a Very Good
Thing to fix, both to have better designed code, and to allow OpenNLP to be
more easily used when exploiting multiple cores.

Our thread-safety strategy is to create one instance per thread and share the model. So you create one SentenceDetectorME per thread, but all instances share
the model.

Having multiple threads sharing one instance can slow down performance when
it is not lock-free.

Jörn

Reply via email to