I tried that but it seems that setting a global on a Stateless session simply sets a value in a Map without doing any validation, hence no Exception.
What I am doing now is to set the value in the Stateless session. It seems that those variables are made available to the StatefulSession that sls.execute() creates underneath the covers. That way I don't have to declare the global in those rulesets that don't use it. Chris On 14/02/2012 13:31, Wolfgang Laun wrote: > But you can > try{ ks.setGlobal(...) } catch( Exception e ){ } > > -W > > On 14/02/2012, Chris Selwyn <ch...@selwyn-family.me.uk> wrote: >> Is there a way to test for the existence of a global variable in a >> StatelessKnowledgeSession before inserting a SetGlobal command into a >> BatchExecutionCommand? >> >> I am trying to write a rules executor class that may execute some rulesets >> that need a particular global variable and some that don't. >> So I would like to be able to automatically test whether the rules that I am >> about to execute have the global variable and if they do not then not to >> insert the SetGlobal into the batch. >> >> I am using DRools 5.1 >> >> Chris Selwyn >> _______________________________________________ >> rules-users mailing list >> rules-users@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users >> > _______________________________________________ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users