that's nice ... n' a bit clever ... it could work ... I mean, i could automatically append that to all sessions given that i control compiling the drls. <div><br></div><div>Is there any setting or something that detects infinite loops? Like it would abort if if drools runs into an infinite loop?</div>
<div><br></div><div>I guess I could do something with fireAllRules(int max) but figuring out a reasonable max would be fuzzy. I could also use the no-loop attribute but it would not pick up some cases of infinite loops.</div>
<div><br></div><div>Thank you very much for you help</div><div><br></div><div>Cheers</div><div>Mike<br><div><br></div><div><br><br><div class="gmail_quote">On Tue, May 15, 2012 at 3:55 PM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A very low salience rule depending on nothing and calling halt will stop the run:<br><br>rule Exit<br>salience -999999999<br>
when<br>then<br> drools.halt();<br>end<span class="HOEnZb"><font color="#888888"><br><br>-W</font></span><div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On 15 May 2012 21:46, mike <span dir="ltr"><<a href="mailto:mikemps@gmail.com" target="_blank">mikemps@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Well I got this wrong sorry. Yes I can stop a session if I start it with
fireUntilHalt() but it never stops. I need it to finish by itself too.<div><br></div><div>Thank you</div><div>Mike</div><div><br><br><div class="gmail_quote">On Tue, May 15, 2012 at 11:06 AM, mike <span dir="ltr"><<a href="mailto:mikemps@gmail.com" target="_blank">mikemps@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">wow that worked like a charm!!! thank you very much
Wolfgang, I owe u a beer or something :)<div><br></div><div>Cheers</div><div><span><font color="#888888">Mike</font></span><div><div><br><br><div class="gmail_quote">On Tue, May 15, 2012 at 11:01 AM, mike <span dir="ltr"><<a href="mailto:mikemps@gmail.com" target="_blank">mikemps@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Awesome I'll try that :)<div><br></div><div>We got business ppl writing rules ... Those rules are going on infinite loops quite often ... Frankly I am not excited about killing the session, for me it's just a business request that I am trying to implement</div>
<div><br></div><div>Thank you very much <span>Wolfgang</span></div><div><br></div><div>Cheers</div><div><span><font color="#888888">Mike </font></span><div><div><br><br><div class="gmail_quote">
On Tue, May 15, 2012 at 10:53 AM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You are confusing jBPM processes and Java threads.<br>
<br>
You can interrupt the thread SessionThread, but that's not reliable<br>
(if IE is handled, for instance),<br>
<br>
Best would be to call fireUntilHalt() and call the session's halt method.<br>
<br>
But why would you want to do this sort of weird thing?<br>
<br>
-W<br>
<div><div><br>
<br>
On 15/05/2012, mike <<a href="mailto:mikemps@gmail.com" target="_blank">mikemps@gmail.com</a>> wrote:<br>
> Hi there,<br>
><br>
> Is there any way to kill a running session?<br>
><br>
> I've been trying with StatefulKnowledgeSession.abortProcessInstance but i<br>
> can't get it working.<br>
><br>
> For instance .. I got this drl<br>
><br>
> rule "infinite loop"<br>
> when x : Integer()<br>
> then<br>
> System.out.println(x);<br>
> Thread.sleep(100);<br>
> insert(x + 1);<br>
> end<br>
><br>
> n' this Thread<br>
><br>
> public class SessionThread implements Runnable {<br>
> private StatefulKnowledgeSession session;<br>
> public SessionThread(StatefulKnowledgeSession session) { this.session =<br>
> session; }<br>
> public void run() { session.fireAllRules(); }<br>
> }<br>
><br>
> then i create a session with the drl n' do something like ...<br>
><br>
> session.insert(42);<br>
> Thread thread = new Thread(new SessionThread(session));<br>
> thread.start();<br>
> Thread.sleep(1000);<br>
> session.abortProcessInstance(thread.getId());<br>
><br>
> I've tried diff processInstanceIds and session.getProcessInstances() but<br>
> nothing seems to stop the running session<br>
><br>
> Thank you<br>
> Mike<br>
><br>
</div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div></div>