I think Prof. Michael Stiber wrote:

> 
> What I tried was to put the firePropertyChange() calls into a 
> synchronized method in my bean, and make all of the property accessors 
> synchronized, too. This didn't work; I assume this just blocked the 
> action of Jess until all the changes were fired, but the shadow fact's 
> slots still updated "one at a time". Is there any way to block Jess 
> during a sequence of firePropertyChange() calls, and then have it 
> update slots en masse?


Synchronize on the activation lock (retrieved from
Rete.getActivationLock()) to prevent rules from firing during a block
of code.


> Actually, now that I look over things, I guess I'll amend my question a 
> bit: Is this merely a mis-feature of (watch facts): that it shows the 
> incremental update? Am I being fooled into thinking that I'm getting 
> rules firing in the middle of these apparently incremental updates, but 
> actually no rules can fire until they're done? Logically, I can't see 
> how that could be the case, as Jess shouldn't "know" that more property 
> change events are coming that should be "grouped".
> 

You're right in your intuition here: if you make a sequence of changes
one after another, nanoseconds apart, then perhaps it's "obvious" that
no rules should fire until the end of the sequence. But computers
don't automatically notice these kinds of things. Nanoseconds and
hours look a lot alike to a computer. If the changes were seconds
apart, or hours apart, you'd want rules to fire in between, yes? Jess
doesn't distinguish timescales the way you might intuitively do.

Anyway: the exact answer depends on how many threads you've created,
and on which thread you're making the series of changes. Do note that
activations can be created and destroyed, and this doesn't mean a rule
is being fired. A rule can activate and deactivate and never fire. You
can use "watch rules" to see when rules actually fire.

Also remember that only one rule can fire at a time. If the sequence
of changes is made from the RHS of a rule, directly or indirectly,
then no other rules can fire until the whole sequence of changes is
made. 


---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        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