[rules-users] no-loop and update vs. PropertyChangeListener

Jaroslaw Kijanowski jaroslaw.kijanowski at redhat.com
Wed May 28 07:44:35 EDT 2008


Hi,
  I'm running the StateExampleUsingSalience example. It uses a fact with 
PropertyChangeSupport.
AFAIUI I don't have to call update() every time I modify this fact in 
the RHS, when I want to have my rules to be reconsidered.

I've modified the drl to look like this:

rule "a"
no-loop true
	when
		b : State(name == "B", state == State.NOTRUN )
	then
		System.out.println(b.getName() + " finished" );
		b.setState( State.FINISHED );
		System.out.println(b.getName() + " finished 2" );
		b.setState( State.NOTRUN );
end


When I insert a State object (name="B", state="State.NONE"), this rule 
would run forever if no-loop wouldn't be set to true. Unfortunately I'm 
wrong. If I want to have no-loop working I need to provide update() 
after b.setState().

So it looks like PropertyChangeSupport doesn't cancel an activation, 
like update() does.

Thanks,
  Jarek



More information about the rules-users mailing list