I have a decision table with one CONDITION column. My fact could match
multiple rules (rows) of the decision table. With each match, the
'ACTION' cause the fact itself to change. I'm using 'modify' as
follows
to change my fact:
modify ($line) { addItem( new Item("DISCOUNT","25%")); }
(essentially I need to add a item to a line when ever the LHS matches).
This works fine when I use a DRL. But when I try to use a decsion table,
I get 'java.util.ConcurrentModificationException' the second time my
fact matches a rule.
Does anyone know if we can modify facts from decision tables ? All the
examples I've seen so far don't show how decision tables handle updating
of facts.
Here's the stack trace I get :
org.drools.runtime.rule.ConsequenceException:
java.util.ConcurrentModificationException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleEx
ception(DefaultConsequenceExceptionHandler.java:23)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1082)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemo
ry.java:682)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemo
ry.java:649)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowle
dgeSessionImpl.java:177)
at
com.sample.DecisionTableTest.main(DecisionTableTest.java:31)
Caused by: java.util.ConcurrentModificationException
at
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at com.sample.Line.addPromotion(Line.java:46)
at
com.lazboy.promotions.Rule_Group_Promotion_14_0.consequence(Rule_Group_P
romotion_14_0.java:7)
at
com.lazboy.promotions.Rule_Group_Promotion_14_0ConsequenceInvoker.evalua
te(Rule_Group_Promotion_14_0ConsequenceInvoker.java:22)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
... 6 more
I'm using Drools Expert 5.0.1.
Thanks
Gurvinder
Show replies by date