Reload java extensions

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

Moderators: Lapo, Bax

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

Reload java extensions

Postby radz » 30 Nov 2008, 17:32

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

Postby radz » 30 Nov 2008, 17:34

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

Postby Lapo » 02 Dec 2008, 07:42

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

Postby radz » 02 Dec 2008, 08:09

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

Postby mhdside » 26 Jul 2009, 14:51

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: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 27 Jul 2009, 07:47

- 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
User avatar
mhdside
Posts: 236
Joined: 04 May 2008, 07:57
Location: Egypt
Contact:

Postby mhdside » 27 Jul 2009, 08:00

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

Postby stix » 01 May 2010, 16:11

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: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 May 2010, 16:26

No, all classes are reloaded, not just the main extension class.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 14 guests