Automatic extension reload on filechange
Automatic extension reload on filechange
What would be great is if an active extension (one that is loaded into a currently active zone/room) would reload itself if it's file is changed. This would save navigating to the zone, then reloading that extension or series of extensions and would speed up development time! Alternatively, is there a command I can send directly to SFS to reload an extension?
Duke,
this feature already exists in SmartFoxServer since version 1.5.x
You can activate it by adding <AutoReloadExtensions>true </AutoReloadExtensions> under the <ServerSetup> node to activate it globally.
Then you have to add the same code in each <Zone> definition where you want the autoreload to be activated.
NOTE: we highly recommend to disable it globally on production servers.
this feature already exists in SmartFoxServer since version 1.5.x
You can activate it by adding <AutoReloadExtensions>true </AutoReloadExtensions> under the <ServerSetup> node to activate it globally.
Then you have to add the same code in each <Zone> definition where you want the autoreload to be activated.
NOTE: we highly recommend to disable it globally on production servers.
Hi Lapo,
This does not seem to work for me. I tested it just by changing the traces in the destroy and init methods of an extension but they are not changed at all when I saved the file.
I do get the message the extension is reloaded but the traces in those methods only shows the original message as during start up. The change only happens after I restart the server.
By the way I am using SFS 1.6.6 PRO with Java extensions.
This does not seem to work for me. I tested it just by changing the traces in the destroy and init methods of an extension but they are not changed at all when I saved the file.
I do get the message the extension is reloaded but the traces in those methods only shows the original message as during start up. The change only happens after I restart the server.
By the way I am using SFS 1.6.6 PRO with Java extensions.
Make sure you have followed these steps:
http://www.smartfoxserver.com/docs/docP ... ons.htm#9a
Also remember that the server monitors your main Extension class (the one extending AbstractExtension) so if you don't overwrite that together with the other classes the auto-reloading won't trigger.
http://www.smartfoxserver.com/docs/docP ... ons.htm#9a
Also remember that the server monitors your main Extension class (the one extending AbstractExtension) so if you don't overwrite that together with the other classes the auto-reloading won't trigger.
Hi Lapo,
I have followed the steps on AutoReloadExtensions and manage to point the classpath to my bin folder. But I am confused at these lines:
So I don't include the javaExtensions folder in my classpath but anything out of the javaExtensions folder won't allow dynamic reloading? It sounds contradicting in my understanding. Please correct me.
I have followed the steps on AutoReloadExtensions and manage to point the classpath to my bin folder. But I am confused at these lines:
Make sure that the javaExtensions/ folder is not comprised in your classpath. By default SmartFoxServer includes this folder in the classpath so that all extension code is loaded at boot-time by the JVM system class loader. While this can be useful for sharing classes across multiple extensions (e.g. Singletons etc...) it will prevent dynamic reloading of the classes. If you remove the javaExtensions/ folder from the classpath, SmartFoxServer will use a separate class loader for each Extension and allowing dynamic reloading.
NOTE: Dynamic reloading does not work outside of the javaExtensions/ folder and does not support .jar files
So I don't include the javaExtensions folder in my classpath but anything out of the javaExtensions folder won't allow dynamic reloading? It sounds contradicting in my understanding. Please correct me.
javaExtensions/ is the root folder for your extensions.
As explained in the docs, if the folder is added to the classpath dynamic reloading won't work. If you remove it, it will.
The reason is the way class loaders work in the JVM.
As explained in the docs, if the folder is added to the classpath dynamic reloading won't work. If you remove it, it will.
The reason is the way class loaders work in the JVM.
Last edited by Lapo on 22 May 2009, 07:04, edited 1 time in total.
Return to “Features Wish List”
Who is online
Users browsing this forum: No registered users and 29 guests