The code you have posted just calls newStatefulKnowledgeSession, which does lock and unlock. But this should not prevent the insertion of facts and the firing of rules executing in parallel. It's pointless to execute newStatefulKnowledgeSession a million times in a single thread and to do nothing else, because this won't be a meaningful use case.
Don't run the million-times-loop. Just waste some cycles between session creation and dispose and see how many of these you can have in parallel.
-W
We create one StatefulKnowledgeSession for every client (if 20 clients at
same time, 20 StatefulKnowledgeSession are created) because every client has
different environment for rule evaluation. Facts for one client does not
have to collide with facts of other clients so this is the reason why we
create multiple sessions.
Let me explain all this in greater detail. When a client executes a SOAP
operation, one StatefulKnowledgeSession is created and associated to the
transaction. Every log generated by the transaction is inserted as a Fact.
When transaction finishes, we fire all rules for the current transaction
knowledge session in order to correlate all transaction logs. This
transaction logs do not have to collide with other transaction logs so every
thread (transaction) has its own StatefulKnowledgeSession.
Our app locks and begin to use only one CPU thread because of
newStatefulKnowledgeSession().
Do you think entry-points would be the solution? Is there any other
solution?
One solution is to use StatefulKnowledgeSession pool who creates instances
but we have to retract all facts when returning session to pool.
Concurrent executions and throughput is a key feature of our SOAP
application.
Thank you very much
--
View this message in context: http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-construction-executes-sequentially-no-multithread-tp3412107p3412222.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