<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
If you do not have shadow facts you cannot use the update() method, it
will leave the working memory corrupted. Instead you must manage this
yourself, before you change any values on the object you must call
modifyRetract() and after you hvae finished your changes ot hte object
call modifyInsert() - luckily if you are doing this in the consequence
you can use the MVEL modify keyword combined with the block setter and
it does this for you:<br>
modify ( person ) { age += 1, location = "london" }<br>
<br>
Mark<br>
Chris West wrote:
<blockquote
cite="mid:20331b80707170902v6ee01a06o89d2fe7f41e9fb96@mail.gmail.com"
type="cite">Hello,<br>
<br>
With prior versions of JBoss Rules (3.0.5) I have been using JDK
generated dynamic proxies as facts, and they have been working fine.
However, after upgrading to JBoss Rules 4.0.0MR3, I cannot seem to get
the dynamic proxies to work as facts. It seems that even though a rule
fires that changes a field on the proxy, a second rule that should not
be activated after the update still fires.
<br>
<br>
According to the JDK javadoc documentation, dynamic proxies are created
as final. My assumption is that JBoss Rules is not creating Shadow
facts for these since they are final. After reading the JIRA at <a
moz-do-not-send="true"
href="http://jira.jboss.com/jira/browse/JBRULES-960">
http://jira.jboss.com/jira/browse/JBRULES-960</a>, I now am questioning
what the effect of not using shadow facts is on the engine. The
relevant part of that is:<br>
<br>
"The problem is that SpringAOP is generating a proxy whose methods
equals() and hashCode() are "final". As drools must either override
these methods in the shadow proxy or not shadow the fact at all, I'm
disabling shadow proxy generation for this use case.
<br>
<div class="action-body">It is really important to note that if you
are asserting SpringAOP
proxies as facts into the working memory, you will not be able to
change any field value whose field is constrained in rules or you may
incur in a memory leak and non-deterministic behavior by the rules
engine. Unfortunately there is nothing we can do about, since when
SpringAOP makes the methods equals and hashcode final, we can't
override them anymore and as so, we can't shadow them."<br>
</div>
<div id="comment-12367491-closed" style="display: none;">
<div
style="background: rgb(240, 240, 240) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<div class="action-links subText smallgrey"> [ <a
moz-do-not-send="true"
href="http://jira.jboss.com/jira/browse/JBRULES-960"
onclick="toggleDivsWithCookie('comment-12367491-open', 'comment-12367491-closed'); return false;"
class="smallgrey">Show »</a> ] </div>
<div class="action-details" style="overflow: hidden; height: 1em;"> <a
moz-do-not-send="true" name="action_12367491"> </a><a
moz-do-not-send="true"
href="http://jira.jboss.com/jira/secure/ViewProfile.jspa?name=tirelli">Edson
Tirelli</a> <font size="-2">[<span class="date">02/Jul/07 03:29 PM</span>]</font>
The problem is that SpringAOP is generating a proxy whose methods
equals() and hashCode() are "final". As drools must either override
these methods in the shadow proxy or not shadow the fact at all, I'm
disabling shadow proxy generation for this use case.
It is really important to note that if you are asserting SpringAOP
proxies as facts into the working memory, you will not be able to
change any field value whose field is constrained in rules or you may
incur in a memory leak and non-deterministic behavior by the rules
engine. Unfortunately there is nothing we can do about, since when
SpringAOP makes the methods equals and hashcode final, we can't
override them anymore and as so, we can't shadow them. </div>
</div>
</div>
<br>
Although I'm not using SpringAOP, I believe my facts are not being
shadowed. <br>
<br>
Is it true that not using shadow facts may lead to non-deterministic
behavior? Prior to shadow facts, the engine seemed to handle it. Any
chance of reverting back to the old style of truth maintenance in the
case of not using shadow facts.
<br>
<br>
I apologize if I'm not on the right track here. My only test case for
my problem is the entire application right now, so I cannot offer it
for discussion. Any advice would be greatly appreciated.<br>
<br>
Thanks,
<br>
-Chris West<br>
<br>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>