Hi there,<div><br></div><div>Is there any way to kill a running session?</div><div><br></div><div>I've been trying with StatefulKnowledgeSession.abortProcessInstance but i can't get it working. </div><div><br></div>
<div>For instance .. I got this drl </div><div><br></div><div><div>rule "infinite loop"</div><div> when x : Integer()</div><div> then</div><div> System.out.println(x);</div><div> Thread.sleep(100);</div>
<div> insert(x + 1);</div><div>end</div></div><div><br></div><div>n' this Thread</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>public class SessionThread implements Runnable {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>private StatefulKnowledgeSession session;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>public SessionThread(StatefulKnowledgeSession session) { this.session = session; }</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> public void run() { session.fireAllRules(); }</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
</div><div><br></div><div>then i create a session with the drl n' do something like ... </div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>session.insert(42);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Thread thread = new Thread(new SessionThread(session));</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>thread.start();</div></div><div> Thread.sleep(1000); <div><span class="Apple-tab-span" style="white-space:pre">                </span>session.abortProcessInstance(thread.getId());</div>
</div><div><br></div><div>I've tried diff processInstanceIds and session.getProcessInstances() but nothing seems to stop the running session</div><div><br></div><div>Thank you</div><div>Mike</div>