See below.

On 06/03/2013, ismaximum <mnr...@gmail.com> wrote:
> Hi
> I have one question and one problem.
> The question is, is multiple instances of stateful session, thread safe?
>
> The problem is, we have a bunch of test cases. Each test class extends from
> an abstract class in which drools session will be created. Previously we
> had
> stateless session so therefore for each test method we had to create a new
> session and call execute() method.
> Now because of the huge number of test methods this runs for about 20
> minutes. So we decided to change the the session to stateful to make it
> faster.
>
> After this change, many of test cases have ended with assertion failure
> which doesn't make sense. I don't know what's wrong here, before each test
> method, we retract any previous fact and we insert new objects.

I'm inclined to say that, given your course of actions, this is very
likely to happen unless you have taken great pains to make your rules
safe from mutual interactions between "transactions" - transactions in
the sense of one related set of inserts/firings/.../retracts. (I can
elaborate on this if necessary.)

>
> Since jnuit runs tests in multiple threads I thought maybe there is an
> issue
> with concurrency.

Yes, but not in the classic sense :-)
-W

>
> Can anyone please help me on this.
> Thanks
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Concurrent-stateful-knowledge-session-tp4022702.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to