Let me start with an apology, that I'm not a big Java hacker and may be missing something basic about the Bean interface. Having said that, I have a problem with beans that have multiple properties and the associated Jess shadow facts. The problem stems from the fact that, each time firePropertyChange() is called, it appears that Jess modifies the shadow fact. So, if more than one property changes, the shadow fact changes multiple times (once for each call). What I'd like to do is make a sequence of firePropertyChange() calls (during one loop in my bean's run() method), and then have the shadow fact update once. Otherwise, I get "spurious" rule firings (rules fire while Jess is still in the process of updating the slots from a sequence of property changes).

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?

I can think of really ugly work-arounds, mostly centered around just having a single property that will change if any of the "real" properties in the object change, and then using the object's methods to "manually" extract the actual properties (I suppose I'd have a rule which detects the changed shadow fact and asserts a new fact with all the "actual" slots --- one rule to rule them all).

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".

Oh, well, now I'm confusing myself.

--
Prof. Michael Stiber                [EMAIL PROTECTED]
Computing and Software Systems      http://faculty.washington.edu/stiber
University of Washington, Bothell   tel: +1-425-352-5280
Box 358534, 18115 Campus Way NE     fax: +1-425-352-5216
Bothell, WA 98011-8246 USA

--------------------------------------------------------------------
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