[rules-users] Killing a session

mike mikemps at gmail.com
Tue May 15 10:38:20 EDT 2012


Hi there,

Is there any way to kill a running session?

I've been trying with StatefulKnowledgeSession.abortProcessInstance but i
can't get it working.

For instance .. I got this drl

rule "infinite loop"
    when x : Integer()
    then
         System.out.println(x);
         Thread.sleep(100);
          insert(x + 1);
end

n' this Thread

public class SessionThread implements Runnable {
 private StatefulKnowledgeSession session;
public SessionThread(StatefulKnowledgeSession session) { this.session =
session; }
         public void run() { session.fireAllRules(); }
}

then i create a session with the drl n' do something like ...

session.insert(42);
Thread thread = new Thread(new SessionThread(session));
thread.start();
                Thread.sleep(1000);
session.abortProcessInstance(thread.getId());

I've tried diff processInstanceIds and session.getProcessInstances() but
nothing seems to stop the running session

Thank you
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120515/a9951b96/attachment.html 


More information about the rules-users mailing list