Yah, that's safe.

Multiple threads using the same WorkingMemory requires external synchronization, available through a wrapper class.

No special handling of app-data/globals is performed. Left as an exercise for the reader.

        -Bob


On Apr 13, 2006, at 4:32 PM, 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