[rules-users] Synchronization requirements on newStatelessKnowledgeSession()?

Greg Barton greg_barton at yahoo.com
Tue Nov 3 17:13:05 EST 2009


No synchronization is needed to call newStatelessKnowledgeSession.

I'm unclear on what you mean by "work with" the stateless session.  While it's running the execute method no outside initiated threads should be interacting with the session.  If outside threads will be initiating interaction you probably should be using a stateful session.  Stateless sessions generally follow this pattern:

StatelessKnowledgeSession session = <make the session>
session.execute(<all of your data>); //blocking call
...do something with the results...

Outside threads shouldn't initiate contact while the blocking call above is processing.  If you do, use the execute(Command) method, which are thread safe, but that's not really the use case for a stateless session.

--- On Tue, 11/3/09, Laird Nelson <ljnelson at gmail.com> wrote:

> From: Laird Nelson <ljnelson at gmail.com>
> Subject: [rules-users] Synchronization requirements on newStatelessKnowledgeSession()?
> To: rules-users at lists.jboss.org
> Date: Tuesday, November 3, 2009, 12:54 PM
> Are there any synchronization requirements
> on calling knowledgeBase.newStatelessKnowledgeSession()? 
> Must I synchronize on anything to make this call in a
> multithreaded environment?
> 
> Once I have a StatelessKnowledgeSession, must I synchronize
> on anything to work with it, or is it truly stateless in all
> regards?
> 
> 
> I'm not sure my previous message on this topic was
> received properly.
> 
> Thanks,
> Laird
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


      




More information about the rules-users mailing list