All,

I am curious if anyone has a solution to the following problem i am seeing....

I have a java project and to keep it simple we'll say it only has one java class - 'Person', and that Person class only has one attribute 'age'. Within my program I am creating a jess shadow fact which maps to the java Person object. So if you change the java object, the jess shadow fact gets updated. All is fine until there are rapid changes in attribute values. For example....if one of my client applications changes a persons age from say 10 to 11, then 11 to 12, and then 12 to 13, really fast, my rules which pattern match on the Person.age attribute only fire once. I think i've tracked this down to the rete.update(instance, slotName) method. I what I think is happening is that after the first change from 10 to 11, the rete.update(instance, slotName) is called, which then goes back to the java object to get the value and by that time, the value has already changed two more times to 13. So the rete.update() grabs 13 and my shadow fact is updated with age=13. This is fine if all you care about is the end value of something, but in this case, I am interested in all changes, so I want my rule to fire each time it changes.

The other problem I am seeing with rapidly changing attributes is that say I change the age of a person from 10 to 11, and then change my mind and change it back from 11 to 10. If this is done really fast, by the time the rete.update(instance, slotName) is called and grabs the value from the java object, it sees that it is back to the original value of 10 so no rules fire in this case because the shadow fact was never updated because it thinks the original and new values are the same. Again, though, I want to be aware that these things changed.
Anyone have ideas on how to handle rapid changes in events?

Thanks in advance!

Joshua


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