The listDefinstance() method iterates over a snapshot of working
memory at the time it is called, so that changes from other threads
(or from the same thread) don't break the iteration. Perhaps the
object is still "live" and it's either running, or other threads are
adding new definstances, while passivateObject is running? 


I think erich.oliphant wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I am using a pool of Rete objects in my application, i've just discovered and
> issue where the my cleanup function seem to intermittently 'miss' a few
> definstances.  Here's the Java code:
> --
> public void passivateObject(Object object) throws Exception {
>         // undef all the java stuff
>         logger.debug("Passivating rete engine, removing all definstances and
> resetting");
>         Rete engine = (Rete)object;
>         Iterator i = engine.listDefinstances();
>         while (i.hasNext())
>         {
>             Object instance = i.next();
>             logger.debug("Instance Type: " + instance.getClass().getName());
>             engine.undefinstance(instance);
>         }
>         ((Rete)object).reset();
>         super.passivateObject(object);
>     }
> --
> With (watch all), I can see the instance facts being removed from working
> memory.  However, for some reason sometimes the Iterator does not seem to get
> all of them.   When the reset is called, I see the initial fact get asserted
> along with the 'missed' definstances.  There doesn't seem to be much rhyme or
> reason with this issue, it happens from time to time but I can't seem to nail
> down why.
> 
> Is Rete.listDefinstances() a reliable way to get all of my definstance facts ?
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to