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.
Reload java extensions
- 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
reloading child classes
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?
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?
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 19 guests