Got it thanks.
ill create a new statefull session for each run and dispose it after it
completes.
2010/9/28 Michael Anstis <michael.anstis(a)gmail.com>
True, thanks Greg.
On 27 September 2010 23:57, Greg Barton <greg_barton(a)yahoo.com> wrote:
> I wouldn't reuse a stateless session. You could reuse a stateful session
> and clean up between runs, but session creation is not that expensive. (and
> easily less expensive than cleanup of a stateful session, mattering on the
> complexity of your rules)
>
> GreG
>
> On Sep 27, 2010, at 8:39, Nadav Hashimshony <nadavh(a)gmail.com> wrote:
>
> My rule engine server is multi threaded.
>
> in the server main i build a knowledgebase:
>
> KnowledgeBuilderConfiguration config =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(droolsConf, null);
> KnowledgeBuilder builder =
> KnowledgeBuilderFactory.newKnowledgeBuilder(config);
> builder.add(ResourceFactory.newFileResource("path to drools pkg",
> ResourceType.PKG);
>
> KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
> knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages());
>
> i have 10 threads that have the following code:
>
>
>
> thread run method:
>
>
> as long as a Vector has data do:
>
> 1. StatelessKnowledgeSession droolsSession=
> m_droolsKagent.getKnowledgeBase().newStatelessKnowledgeSession();
> 2. get data object from a vector
> 3. create fact model from data
> 4. droolsSession.insert(facts);
> 5. droolsSession.fireAllRules();
> 6. do stuff with the response
> 7.droosSession.dispose
> 8.get next object from vector.
>
>
> Questions:
> 1. should i create each time the droolsSession? or can i resuse the same
> one, meaning can i create it in the Thread's constractor?
>
> Thanks
> Nadav.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users