java is pass by reference, so all you are doing is assigning the local test pointer to point to something else; which ofcourse won't be reflected in the global resolvers

drools.getWorkingMemory.setGlobal("test", test");

Mark
vdelbart wrote:
Hi,
My rule is :
#created on: 29 août 2007
package example

#list any import classes here.
global Boolean test

rule "Your Third Rule"
        #include attributes such as "salience" here...
        when
then #actions
                test = true;
                System.out.println("OK-" + test);
end

In my java codes, I have :

session.setGlobal("test", new Boolean(false));
System.out.println("global " + session.getGlobal("test"));
session.fireAllRules();
System.out.println("global " + session.getGlobal("test"));

I expect this :
global false
OK-true
global true

but I have :
global false
OK-true
global false

Anybody have a solution to manipulate Boolean object in globals ?


thanks,

V.



_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to