[rules-users] Infinte Loop problem

benjimcc ben.mccarthy at cdl.co.uk
Wed Dec 5 05:38:28 EST 2007


Im sure people have seen this before ive searched high and low for an answer
but no luck, fairly new to using drools so any advice would be much
appreciated.  Here is a sample of my rules:

rule "Gender Desirability"
	salience 400
	no-loop true
	when
		$broker : Broker(brokerName=="bah")
		Proposer(gender == "F")
	then
		int desirability = $broker.getDesirability() + 10;
		$broker.setDesirability(desirability);	
		update($broker);
		System.out.println("Gender Hit");
end


rule "Age Desirability"
	salience 200
	no-loop true
	when
		$broker : Broker(brokerName=="bah")
		$proposer : Proposer($dob : dateOfBirth)
		$rulesrequest : RulesEngineRequest($inception : inceptionDate)
	
eval(age_desirability_flex.isInRange($proposer.getAge($dob,$inception))==true)
	then
		int desirability = $broker.getDesirability() + 20;	
		$broker.setDesirability(desirability);
		update($broker);		
		System.out.println("Age Hit");	
end

rule "Check Desirability"
	salience 190
	when
		$broker : Broker($des : desirability,brokerName=="europa")
		eval($des < desirability_Index)
	then
		$broker.setInclude(false);
		retract($broker);
end



Ok basically all the 'when' bits work.  But what seems to happen is that
when the update happens and the rules are evaled again and it ping pongs
between the two rules as they both update the Broker object.  Resulting in
the 'Check Desirability' never being hit and for debug spewing 'Gender Hit'
'Age Hit' in a infinite loop till te JVM runs out of memory and it crash and
burns.

Any help in this would be much appreciated.  If you need any more
information let me know as well.

Thanks
Ben

"The views opinions and judgments expressed in this message are solely those
of the author.  The message contents have not been viewed or reviewed or
approved by CDL"
-- 
View this message in context: http://www.nabble.com/Infinte-Loop-problem-tf4948564.html#a14168484
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list