[rules-users] Trouble with shadow proxies, insertLogical, and WorkingMemoryListener

A Gattiker agattik at gmail.com
Fri Aug 17 03:22:26 EDT 2007


I have an interface called InducedFact. Rules use insertLogical to
insert instances of implementing classes, and a working memory
listener allows me to control the application when those facts are
inserted and removed.

However in some cases, the fields of my InducedFact class have been
changed to null when my event listener's 'objectRetracted' method is
called, although they have been properly initialized upon
'objectInserted'. Even the debugger could not see when the fields were
set back to null. I have not been able to create a simple test case to
reproduce it, however.

Excluding the implementing classes from shadow proxying does solve the
problem. However it is a bit inconvenient to have to give the full
list of implementing classes (passing the interface name with the code
below doesn't work). Also, the rule base may have been serialized, and
I would have to recreate it every time I create a new InducedFact
implementing class.

RuleBaseConfiguration rbConf = new RuleBaseConfiguration();
        rbConf.setShadowProxy(true);
        rbConf.setShadowProxyExcludes(InducedFact.class.getName());

Wouldn't it be more flexible to configure the working memory elsewhere
than in the rule base configuration?

Thanks in advance for your insights.



More information about the rules-users mailing list