Just in case anybody wonders about the effort for building a mechanism for retracting facts based on fact attributes or other data, I outline the solution I have implemented.<br><br>My class FactWiper implements WorkingMemoryEventListener and Runnable.<br>
<ul><li>The implementation of objectInserted( ObjectInsertedEvent event ) determines whether the object needs handling and, if so, the retraction Date, based upon whatever strategy you care to implement, e.g., reflection method call, Map&lt;Class,Long&gt;, etc. If it is to be handled, it signals Condition &quot;change&quot; to the thread.<br>
</li><li>A SortedMap&lt;Date,Object&gt; expiry2fact keeps track of pending retractions.</li><li>The thread loops into an awaitUntil( x ) on the &quot;change&quot; condition, where x is (generally) the first retraction Date. If reached, it retracts according to the foremost Map entry; if signalled it reasesses the situation and reenters the awaitUntil.</li>
</ul>-W<br><br><br><div class="gmail_quote">2010/11/12 Michael Anstis <span dir="ltr">&lt;<a href="mailto:michael.anstis@gmail.com">michael.anstis@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
A time based eviction queue is simply a queue that evicts its content based upon time-based heuristic. So the WorkingMemoryEventListener would store facts inserted into the WorkingMemory in an internal queue and evict them from that queue based upon some time-based heuristic. You could use an Executor (ScheduledExecutorService) etc to remove facts from the queue and working memory at set intervals.<br>

<br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 11 November 2010 22:31, Ayush <span dir="ltr">&lt;<a href="mailto:ayush.vatsyayan@alcatel-lucent.com" target="_blank">ayush.vatsyayan@alcatel-lucent.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Can you please elaborate on &quot;Have it store each inserted object in a<br>
time based eviction queue and it&#39;ll remove things for you.&quot; i.e. how can I<br>
do it?<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1885760.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1885760.html</a><br>


Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>