I'm not convinced whether this the right way to go but technically you
could create a JessEvent listener for JessEvent.DEFRULE_FIRED and
compare the current rule fired with the previous - of course to detect
indirect recursions it will get more difficult ...
HTH,
tge
C�sar Colado Rodr�guez wrote:
>
> Hi,
> I am working with Jess and JavaBeans, and when a rule has in the LHS a fact
> that is modified in its RHS the rule is activated again and again, and my
> system calls in an infinite loop.
>
> I know, this is how it should work, but in my enviroment a lot of people can
> add rules so this situation sometimes happens. What I would like to do is to
> detect the infinite loop, in order to stop it. The condition to detect the
> infinite rule could be that the same object activates the same rule several
> times.
>
> I applied this:
>
> (defclass simple SimpleBean)
>
> (defrule initial
> (initial-fact)
> =>
> (bind ?bs (new SimpleBean))
> (definstance simple ?bs dynamic)
> )
>
> (defrule rule-1
> ?s <- (simple (name ?name)(parents $?parents)(age ?age)(discount
> ?discount)(OBJECT ?obj))
>
> =>
> (printout t "SimpleBean" crlf)
> (call ?obj setAge (+ ?age 1.0))
> )
>
> Is there a way to detect the infinite loop?
>
> Thanks.
>
> C�sar Colado
>
>
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
Thomas Gentsch
--------------
---------------------------------------------------------------------
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]
---------------------------------------------------------------------