Hrm.. I guess I tried this.. (made a class that implemented Runnable.. put ruleEngine.runUntilHalt() in the run() method).
Then frmo an outside class, I did Thread t = new Thread(RuleClass); t.run(); which never comes back.. I need to go read about Threads again i guess.. just been too long since I did anything with them outside of EventDispatch and Swing Roger On 4/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I think Roger Studner wrote: > > > > Why do I have to do engine.run() *again* to get my rules to fire? > > Rules fire only during a call to run(). WHen there are no rules to > fire, run() returns. Jess doesn't create any Threads of its own; > things happen synchronously, during calls to Jess methods. > > > I mean, does this mean I have to have a loop 'constantly' calling > > engine.run() over and over? > > Nope, that's what runUntilHalt() does -- it never returns until you > explicitly stop it by calling halt(). It doesn't just call run() in a > loop, though -- it uses wait() and notify() so that it uses 0 CPU > cycles until there are actually rules to fire. > > Note that if you want the engine to run forever, then that will tie > up a Java thread -- the thread that calls runUntilHalt() won't be > available to run any more of your code, since runUntilHalt() won't > return. So generally, you create a dedicated thread to call this > method, or you call it as the last method of a script, having arranged > for something to happen asynchronously in some other threads. > > > > --------------------------------------------------------- > 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://herzberg.ca.sandia.gov > > -------------------------------------------------------------------- > 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]
