knowledge sessions are not thread-safe so I believe your assumptions are correct. To be on
the safe side you should change the ksession bean to have scope "prototype".
----- Original Message -----
From: "Gurvinder Narula1" <gnarula1(a)la-z-boy.com>
Sent: Tuesday, 27 November, 2012 3:08:18 PM
Subject: [rules-users] Question about drools-spring in a multi-treaded container (like
I've been reading up about drool-spring integration and have put
together a simple project that wires together a KnowledgeBase and
KnowledgeSession as follows :
< drools:resource id = "GroupUnit" type = "DRL"
< drools:resource id = "GradeUnit" type = "DRL"
source = "
< drools:resource id = "EvaluateUnit" type = "DRL"
source = " file:/Users/drools/drools-spring-test/src/Rules/drls/
EvaluateUnit .drl" " />
< drools:grid-node id = "node1" />
< drools:kbase id = "kbase1" node = "node1" >
< drools:resources >
< drools:resource ref = "GroupUnit" />
< drools:resource ref = "GradeUnit" />
< drools:resource ref = "EvaluateUnit" />
</ drools:resources >
</ drools:kbase >
< drools:ksession id = "ksession" type = "stateful" kbase =
node = "node1" />
The main question that I have is that – is this solution thread-safe
? From what I understand of spring is that beans configured without
any additional qualifiers are inherently singletons. And when
deployed in a multi-theaded container like tomcat, Spring assumes
that the beans being severed up a thread-safe. So from I have read
is that KnowledeSessions are inherently not thread safe. So putting
the 2 together, I leaning towards the assessment that this above
solution is NOT thread safe and that if I do want it to be thread
safe I should set the StatefulKnowledgeSession to 'prototype' and
not leave it as a singleton.
Please let me know if I'm missing anything in my assessment here !
Thanks in advance,
This message is intended only for the individual or entity to which
it is addressed. It may contain privileged, confidential information
which is exempt from disclosure under applicable laws. If you are
not the intended recipient, please note that you are strictly
prohibited from disseminating or distributing this information
(other than to the intended recipient) or copying this information.
If you have received this communication in error, please notify us
immediately by e-mail or by telephone at the above number. Thank
rules-users mailing list