Synchronization requirements on newStatelessKnowledgeSession()?

2 messages Options
Embed this post
Permalink
ljnelson

Synchronization requirements on newStatelessKnowledgeSession()?

Reply Threaded More More options
Print post
Permalink
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

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Greg Barton

Re: Synchronization requirements on newStatelessKnowledgeSession()?

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]> wrote:

> From: Laird Nelson <[hidden email]>
> Subject: [rules-users] Synchronization requirements on newStatelessKnowledgeSession()?
> To: [hidden email]
> 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
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>


     

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users