Hi Stanbol uses a single instance of Models (e.g. POSModel). They are loaded and managed by the OpenNLP service (commons.opennlp module). Stanbol does not reuse OpenNLP Tagger, Finder, ... objects build on top of models (e.g. POSTagger on top of the PosModel). So each request will create a new instance. This is exactly because PostTagger, Tokenizers ... are not thread safe (as stated by the documentation). As the documentation also mentions hat those objects are rather light weight it was not taken in considerations to cache those things in ResourcePools are ThreadLocal variables.
best Rupert On Sat, Mar 2, 2013 at 1:23 PM, harish suvarna <[email protected]> wrote: > OpenNLP documentation says postagger and tokenizer etc are not thread safe. > Couple of Internet posts and OpenNLP discussion forums also indicate this. > How is Stanbol using OpenNLP to make it thread safe? Do you use java > synchonised or thread-local or any java locking to make it thread safe.? > I have not ran into this thread safe issues in Stanbol yet. Opennlp guy > says create one instance of opennlp components per thread. > > http://grokbase.com/t/opennlp/dev/1176mzaen1/thread-safety-or-lack-thereof > -- > Thanks > Harish -- | Rupert Westenthaler [email protected] | Bodenlehenstraße 11 ++43-699-11108907 | A-5500 Bischofshofen
