For 2.5 yes.

For 2.0 and 2.1 some methods were synchronised on WorkingMemory, but not all - no wrapper was provided.

Mark
Susan G Lee wrote:
does this hold true for 2.5 also?


Thanks,
Susan G. Lee





Mark Proctor <[EMAIL PROTECTED]> 04/13/2006 04:36 PM
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: [drools-user] Application Data Thread safe in drools






ruleBase.newWorkingMemory() is thread safe - as long as you are not using dynamc rules - i.e. adding new packages while doing it, which most peopel aren't.

workingMemory.assertObject() is only thread safe if you used the SynchronisedWorkingMemory wrapper - by default no methods are synchronised in Drools.

Mark

Yuesong Wang wrote:
No nothing is thread safe in Drools 3.0

Mark, can you please clarify this statement? Are you
referring to all Drools classes? Or you simply meant
that the objects we use wouldn't get special
protection from Drools?

I raised the question a while back about the
thread-safety of RuleBase, and got a positive answer
from Michael. Now this sweeping statement got me
worried again.:) My scenario:

Multiple threads accessing the same instance of
RuleBase, each creating a new WorkingMemory, asserting
their own facts, then firing.

Can RuleBase handle that?

Thanks,

Yuesong



--- Mark Proctor <[EMAIL PROTECTED]> wrote:


No nothing is thread safe in Drools 3.0 - unless you
use the SyncrhonisedWorkingMemory. then it just adds a synch method to each of thte WorkingMemory methods. With regards to "application data" no called globals - if you use that wrapper the workingMemory.setGloba(...) is synchronized but ofcourse if you change fields inside of a global already in the working memory then that is up to you, its not something Drools can control.

Mark
Susan G Lee wrote:

Hi,

Is the application data in the drl files thread

safe? For example, if one
thread comes in the call a rule that requires to

modify the application
data.  Before it finishes, another thread comes in

to modify the same
application data variable and completes the

processing. would the first
thread see the second thread's modification or it

will still see the value
that it modified to?



Thanks,
Susan G. Lee


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com






Reply via email to