[rules-users] Globals - delegate

Mark Proctor mproctor at codehaus.org
Tue Jul 3 04:46:39 EDT 2012


On 02/07/2012 14:11, Wolfgang Laun wrote:
> 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?)
probably infinite recursion, on 'get'.

Mark
>
> -W
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list