We were using 1.6.2 with 1.6.6 patch. Recently we did fresh install of 1.6.6. We now see that multiple objects of our singleton class are created.
Same code works as expected in 1.6.2 with 1.6.6 patch. But we see multiple objects of singleton class in fresh 1.6.6 setup.
It seems somehow code is running on multiple JVMs. Is that possible ?
Lapo please comment.
Problem with Singleton classes
It's a simple problem with the javaExtensions/ folder.
I think you simply need to include it in your classpath. It was removed in 1.6.6 because it inhibits the runtime reloading of Java code.
You can get more details here:
http://www.smartfoxserver.com/docs/docP ... ons.htm#9a
I think you simply need to include it in your classpath. It was removed in 1.6.6 because it inhibits the runtime reloading of Java code.
You can get more details here:
http://www.smartfoxserver.com/docs/docP ... ons.htm#9a
Hi,
I have the same issue.
To avoid loading from the DB all the time, I want to use a singleton to load all the properties of my game elements.
This singleton must be accessible and persistent across all my extensions (I use an extension for lobby, another one for matchmaking and another one for the actual game).
I understand your solution, I just want to know if it's "bad practice" in any way to disable automatic reloading and, especially, to add the folder to the classpath ?
I can live with automatic reloading in dev (with singletons not shared) but I want to be sure I'm not missing any other "unexpected" behavior.
Anyway, this seems like a huge difference of behavior to me, should be very visible in the doc
Thanks,
Sebastien
I have the same issue.
To avoid loading from the DB all the time, I want to use a singleton to load all the properties of my game elements.
This singleton must be accessible and persistent across all my extensions (I use an extension for lobby, another one for matchmaking and another one for the actual game).
I understand your solution, I just want to know if it's "bad practice" in any way to disable automatic reloading and, especially, to add the folder to the classpath ?
I can live with automatic reloading in dev (with singletons not shared) but I want to be sure I'm not missing any other "unexpected" behavior.
Anyway, this seems like a huge difference of behavior to me, should be very visible in the doc
Thanks,
Sebastien
No it's not bad practice at all.I understand your solution, I just want to know if it's "bad practice" in any way to disable automatic reloading and, especially, to add the folder to the classpath ?
Good news is... we have simplified and enhanced classpath and class loading significantly in the new SmartFoxServer 2X, coming out next week
cheers
So is there a way we can use Singleton classes as well as use Automatic Reloading of extensions ?Lapo wrote:It's a simple problem with the javaExtensions/ folder.
I think you simply need to include it in your classpath. It was removed in 1.6.6 because it inhibits the runtime reloading of Java code.
You can get more details here:
http://www.smartfoxserver.com/docs/docP ... ons.htm#9a