(I don't want to confuse things by adding to the recent thread on the user list. And I do hope that I got this right. Please read carefully and correct me. Thanks.)
The statement "StatefulKnowledgeSession is thread-safe" must be annotated with caveats so that users don't overload this basically simple statement with meaning that isn't logically implied by it. StatefulKnowledgeSession is thread-safe means that any two threads cannot interact in such a way that it would corrupt data protected by the implementing object. It does not mean that all code executed on behalf of the data maintained by a Stateful Knowledge Session object is thread-safe. In particular, the execution of a consequence is not a critical section from the session's point of view. The existence of an activation implies that the LHS conditions are true for the objects playing a part. As soon as one thread begins actions based on these preconditions and is on its way to modifying one or more facts, any other thread doing likewise with any of the participating objects in this or another RHS is running into a race condition. If a consequence execution is a critical section for some application object, it is the user's responsibility to achieve proper synchronisation, either for entire consequences or for individual fact objects. -W _______________________________________________ rules-dev mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-dev
