Hi all !
I need your help to troubleshoot my problems.
[ I wrote java server - smartfoxserver2x]
I have a class
class LibGame
{
public static Hashmap<Interger, String> testVariable = new Hashmap<Interger, String>();
}
in class UserJoinzone.class , I wrote as follows:
LibGame.testVariable.put(1, "a");
system.out.print(LibGame.testVariable.size()) => return 1;
after user joins room, in UserJoinRoom.class, I wrote as follows:
LibGame.testVariable.put(2, "b");
system.out.print(LibGame.testVariable.size()) => return 1;
if I get size of testvariable at the UserJoinRoom value = 2 is true, but it only = 1, this can means variable testvariable not be shared.
How can I solve this?
My english is not good. Hope everyone can help me.thank you!
How can share a static variable for zone and room ?
Re: How can share a static variable for zone and room ?
The problem is that two Extensions exist in two separate classloaders so thy don't know each others.
Please read here: http://docs2x.smartfoxserver.com/Advanc ... assLoading
If you want to share a model across several extension you could deploy your data classes in the extensions/__lib__/ folder so that they are seen globally, in terms of class loading.
Please read here: http://docs2x.smartfoxserver.com/Advanc ... assLoading
If you want to share a model across several extension you could deploy your data classes in the extensions/__lib__/ folder so that they are seen globally, in terms of class loading.
Re: How can share a static variable for zone and room ?
ok,I have resolved . thanks so much, Lapo.
Who is online
Users browsing this forum: No registered users and 94 guests