In this case, I would just use clear out the working memory:
for( Person p: ... ){
insert( p );
ksession.fireAllRules();
for( Object object: ksession.getObjects() ){
ksession.retract( ksession.getFactHandle( object ) );
}
}
without recreating another ksession for the next Person (no dispose(), no
newStatefulKnowledgeSession() )
But there's
ksession.startProcess(this.file);
and anything might happen there, so all bets are off...
-W
On 15 December 2010 16:14, saynyshy <saynyshy(a)gmail.com> wrote:
Sorry, I couldn't explain it correctly (first time you understand me
correct)
So, please see the code (no it was really realised as you said before ->
every time start new session but...)
I'l try to show example:
private KnowledgeBase kbase;
...
kbase = readKnowledgeBase(ruleflowfileSheme, rulefileslistDrl);
kbase.newStatefulKnowledgeSession();
...
I need to check some Persons in rules:
List<Person>ls
for(Person p:ls){
check(p);
}
I'm using method
public boolean check(Person p){
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
...
ksession.insert(p);
ksession.startProcess(this.file);
ksession.fireAllRules();
ksession.dispose();
// here i need remove all objects from memory (all
drools.insert's etc) &
p too...
return false;
}
Every time I use new session, because i can't remove all objects from
memory
after (current checked list element)
Person p was checked in all rules. How can I do this????
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/How-to-continue-sessi...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users