You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@opennlp.apache.org by Lance Norskog <go...@gmail.com> on 2012/05/19 05:52:33 UTC

Multithreaded model use?

Are the Model classes (subclasses of
opennlp.tools.util.model.BaseModel) guaranteed to be thread-safe? That
is, can I re-use the same SentenceModel in two different
SentenceDetectors and be sure there is no concurrency problems?

If this is true, please add this to the BaseModel javadoc.

-- 
Lance Norskog
goksron@gmail.com

Re: Multithreaded model use?

Posted by Lance Norskog <go...@gmail.com>.
Right, I'm loading models and caching them. Then each active use makes
its own ME and detector/tokenizer/etc. The model object is just a
passive bucket. It is essentially "final".

As to JIRAs: I'm used to much larger projects and JIRA pollution
becomes a problem. It's not like this is Open Relevance :)

On Sat, May 19, 2012 at 3:21 AM, Jim - FooBar(); <ji...@gmail.com> wrote:
> On 19/05/12 09:34, Jörn Kottmann wrote:
>>
>> On 05/19/2012 05:52 AM, Lance Norskog wrote:
>>>
>>> Are the Model classes (subclasses of
>>> opennlp.tools.util.model.BaseModel) guaranteed to be thread-safe? That
>>> is, can I re-use the same SentenceModel in two different
>>> SentenceDetectors and be sure there is no concurrency problems?
>>>
>>> If this is true, please add this to the BaseModel javadoc.
>>>
>>
>> They are thread safe. You are welcome to open a jira issue
>> and provide a patch to fix this.
>>
>> Jörn
>
>
> Hi Jorn,
>
> If they are thread-safe, what is there to fix? Are you just referring to the
> documentation?
>
> So, the models are thread-safe, but the detector,finder, tokenizer objects
> are not?
>
> Jim
>
>



-- 
Lance Norskog
goksron@gmail.com

Re: Multithreaded model use?

Posted by "Jim - FooBar();" <ji...@gmail.com>.
On 19/05/12 09:34, Jörn Kottmann wrote:
> On 05/19/2012 05:52 AM, Lance Norskog wrote:
>> Are the Model classes (subclasses of
>> opennlp.tools.util.model.BaseModel) guaranteed to be thread-safe? That
>> is, can I re-use the same SentenceModel in two different
>> SentenceDetectors and be sure there is no concurrency problems?
>>
>> If this is true, please add this to the BaseModel javadoc.
>>
>
> They are thread safe. You are welcome to open a jira issue
> and provide a patch to fix this.
>
> Jörn

Hi Jorn,

If they are thread-safe, what is there to fix? Are you just referring to 
the documentation?

So, the models are thread-safe, but the detector,finder, tokenizer 
objects are not?

Jim



Re: Multithreaded model use?

Posted by Jörn Kottmann <ko...@gmail.com>.
On 05/19/2012 05:52 AM, Lance Norskog wrote:
> Are the Model classes (subclasses of
> opennlp.tools.util.model.BaseModel) guaranteed to be thread-safe? That
> is, can I re-use the same SentenceModel in two different
> SentenceDetectors and be sure there is no concurrency problems?
>
> If this is true, please add this to the BaseModel javadoc.
>

They are thread safe. You are welcome to open a jira issue
and provide a patch to fix this.

Jörn