[rules-users] Globals - delegate

Wolfgang Laun wolfgang.laun at gmail.com
Mon Jul 2 09:11:34 EDT 2012


This is from Expert (5.4.0):

Using a delegate is another way of global resolution. Assigning a
value to a global (with setGlobal(String, Object)) results in the
value being stored in an internal collection mapping identifiers to
values. Identifiers in this internal collection will have priority
over any supplied delegate. Only if an identifier cannot be found in
this internal collection, the delegate global (if any) will be used.

For setting a delegate, I've found org.drools.runtime.Globals and
   void Globals.setDelegate(Globals delegate)
 and the KnowledgeRuntime /StatelessKnowledgeSession method
   Globals getGlobals()

Does this mean that one might take a Globals object from one session
and use it as a delegate to the Globals of another session?

(Evil thought:
   Globals a = sessionA.getGlobals();
   Globals b = sessionB.getGlobals();
   a.setDelegate( b );
   b.setDelegate( a );
What happens then?)

-W


More information about the rules-users mailing list