The easiest thing to do is add a rule with a low salience (I use -1000) that will always match and add whatever action on the rhs that you want to use to signal all rules are done being processed. This rule will always be added to the end of the agenda, so when it fires, you know there are no more rules waiting to be fired.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shi Paul Sent: Friday, February 09, 2007 1:46 PM To: jess-users@sandia.gov Subject: Re: JESS: How do I determine Jess engine has finished firing rules Hi, Actually I have created its own thread and then in that thread I call rete.runUntilHalt. Then I run into this issue just mentioned, can you give me some more specifics about the solution as how to determin if the engine is not busy and can safely be stopped? I'd imagine that the main thread could just wait on some semaphore the jess thread operates or call into some API which does the same thing. Thanks, Paul >From: "Ernest Friedman-Hill" <[EMAIL PROTECTED]> >Reply-To: jess-users@sandia.gov >To: jess-users@sandia.gov >Subject: Re: JESS: How do I determine Jess engine has finished firing rules >Date: Fri, 9 Feb 2007 13:19:29 -0500 > > >On Feb 9, 2007, at 12:15 PM, Shi Paul wrote: > >>Hi there, >>Is there an API to determine the rule engine has completed its work. I'd >>like to call rete.halt() to stop the engine, but I'm wondering what if >>the engine is still firing rules when I call that. Can anybody shed some >>lights on it? >> > >Jess doesn't create any threads on its own. If you call rete.run(), then >run() returns when, and only when, there are no more rules to fire. If you >have multiple threads, then you can set up your own notification scheme >based on that. > > >--------------------------------------------------------- >Ernest Friedman-Hill >Advanced Software Research Phone: (925) 294-2154 >Sandia National Labs FAX: (925) 294-2234 >PO Box 969, MS 9012 [EMAIL PROTECTED] >Livermore, CA 94550 http://www.jessrules.com > >-------------------------------------------------------------------- >To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' >in the BODY of a message to [EMAIL PROTECTED], NOT to the list >(use your own address!) List problems? Notify [EMAIL PROTECTED] >-------------------------------------------------------------------- > _________________________________________________________________ http://local.live.com/default.aspx?v=2&cp=43.658648~-79.383962&style=r&l vl=15&tilt=-90&dir=0&alt=-1000&scene=3702663&cid=7ABE80D1746919B4!1329 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -------------------------------------------------------------------- -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------