Reload java extensions

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
radz
Posts: 16
Joined: 06 Oct 2005, 07:38

Reload java extensions

Post by radz »

I'm having a problem reloading java extensions without restarting the server. I have AutoReloadExtensions set to true and the console shows a message that extension has been reloaded, but it uses a cached version of the old class file. Same if I reload from the admin. If I restart the server, the new class is loaded without problem.

I using version 1.6.2.
radz
Posts: 16
Joined: 06 Oct 2005, 07:38

Post by radz »

Sorry, meant to post this in the "Server Side Extension Development" section..
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Remove the "javaExtensions/" folder from the classpath. It will do the trick
Lapo
--
gotoAndPlay()
...addicted to flash games
radz
Posts: 16
Joined: 06 Oct 2005, 07:38

Post by radz »

Worked perfect, thanks!
mhdside
Posts: 236
Joined: 04 May 2008, 07:57
Location: Egypt

Post by mhdside »

I want to know :

- is there any downsides for removing the ./javaExtensions/; from the classpath?

- if the answer is no, why does it already exists in the classpath and why is it causing the problem of having to restart the server to update java extension...
Mahmoud Badri
Senior actionscript developer
http://www.el3ab.com
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

- is there any downsides for removing the ./javaExtensions/; from the classpath?
Not particularly.
By doing so you can enable runtime Java Extension reloading
- if the answer is no, why does it already exists in the classpath and why is it causing the problem of having to restart the server to update java extension...
This requires that you understand how class loaders work in Java.
With javaExtensions/ in the classpath your Extension classes will be loaded by the System ClassLoader, so you won't be able to reload them at runtime.

If javaExtensions/ is NOT in the classpath each Extension will be loaded in its own ClassLoader and dynamic reloading becomes possible
Lapo
--
gotoAndPlay()
...addicted to flash games
mhdside
Posts: 236
Joined: 04 May 2008, 07:57
Location: Egypt

Post by mhdside »

interesting, although I`m not going deep into java, not to ClassLoaders but thanks for clearing how it works. thanks Lapo!
Mahmoud Badri
Senior actionscript developer
http://www.el3ab.com
stix
Posts: 9
Joined: 01 May 2010, 15:51

reloading child classes

Post by stix »

So this works for loading extensions specified in the config.xml. But what if there is only one "extension" class that instantiates other classes loaded from other java files.

Like:

public void handleInternalEvent(InternalEventObject ieo)
{
if (ieo.getEventName().equals("loginRequest"))
{
myCustomLogin login = new myCustomLogin(this);
login.loginUser(ieo);
}
}


In this case, only the parent extension gets reloaded, not all the other classes. Is there a way in Java to clear the heap memory without rebooting the server?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

No, all classes are reloaded, not just the main extension class.
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply