<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi All,<div><br></div><div>i've a simple rules that retract objects form the WM</div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">rule</font><font face="Monaco" size="3" style="font: 11.0px Monaco"> </font><font face="Monaco" size="3" color="#008000" style="font: 11.0px Monaco; color: #008000">"Retract From ArrayList"</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span></font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">when</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>$total: ArrayList() </font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">from</font><font face="Monaco" size="3" style="font: 11.0px Monaco"> </font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">collect</font><font face="Monaco" size="3" style="font: 11.0px Monaco"> ( PrestationFacturable() )</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span></font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">then</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span></font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">retract</font><font face="Monaco" size="3" style="font: 11.0px Monaco">($total.get(0));</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">end</font></div><div><font class="Apple-style-span" color="#960000" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div>at the end of fireAll all the fact are well retracted but if I replace ArrayList by TreeSet</div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">rule</font><font face="Monaco" size="3" style="font: 11.0px Monaco"> </font><font face="Monaco" size="3" color="#008000" style="font: 11.0px Monaco; color: #008000">"Retract From TreeSet"</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span></font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">when</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>$tree: TreeSet() </font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">from</font><font face="Monaco" size="3" style="font: 11.0px Monaco"> </font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">collect</font><font face="Monaco" size="3" style="font: 11.0px Monaco"> ( PrestationFacturable() )</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span></font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">then</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span></font><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">retract</font><font face="Monaco" size="3" style="font: 11.0px Monaco">($tree.first());</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" color="#960000" style="font: 11.0px Monaco; color: #960000">end</font></div><div><font class="Apple-style-span" color="#960000" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" color="#960000" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" color="#960000" size="3"><span class="Apple-style-span" style="font-size: 11px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 12px; ">I got the following exception</span></span></font></div><div><font class="Apple-style-span" color="#960000" size="3"><span class="Apple-style-span" style="font-size: 11px;"><div>org.drools.spi.ConsequenceException: org.drools.FactException: Retract error: handle not found for object: [6, val=1]. Is it in the working memory?</div><div><br></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 12px; ">because the $tree (at second run) still contains the object that as been removed </span></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;">can somebody can explain this behavior ?</span></font></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;">Thanks in advance</span></font></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="font-size: 12px;">-P.</span></font></div></span></font></div></div></div></body></html>