Reputation: 117
I developed an applet and I reload it when it finishes some task. I accomplished that using javascript:
function startApplet() {
// code to setup "object" tag
var appletHtml = '<object name= ....'
document.getElementById("applet_tag").innerHTML = appletHtml;
}
function restartApplet() {
if (document.getElementById("applettag")) {
document.getElementById("applet_tag").innerHTML = '';
}
startApplet();
}
That works perfectly in some machines but in others the javascript code is executed but the applet doesn't reload (disappear current instance, start a new one)
I already tried with <param name="cache_option" value="no">
or using jquery code to reset applet div with no success.
Anyone knows about this issue or knows another way to reload the applet without refreshing page?
Looking at Java console, I infer that applet efectively restart, but I think I need that the applet restart in a new JVM instance. Below, I attached an extract of the java console:
basic: Applet loaded.
...
basic: Applet initialized
basic: Starting applet
...
basic: Applet started
basic: Told clients applet is started
basic: Starting applet teardown
basic: Finished applet teardown
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@d062ed
basic: PluginMain.unregisterApplet: 1 from mananger sun.plugin2.applet.Applet2Manager@ca5165
basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@185c219
basic: Plugin2ClassLoader.addURL parent called for http://...
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 359544 us, pluginInit dt 55298741 us, TotalTime: 55658285 us
Applet inicializado
basic: Applet initialized
basic: Starting applet
basic: completed perf rollup
basic: Applet made visible
basic: Applet started
basic: Told clients applet is started
Upvotes: 1
Views: 3499
Reputation: 117
I found the solution in applet in new jvm, using separate_jvm applet parameter, official deployment documentation in applet deployment. Thank you.
Upvotes: 1
Reputation: 4598
instead of directly calling startApplet put it on a 15 second timeout. That will allow the jvm to exit.
function restartApplet() {
if (document.getElementById("applettag")) {
document.getElementById("applet_tag").innerHTML = '';
}
setTimeout("startApplet()", 15000);
New JVM Not tried this but you could
var apltIdCnt = 1
function startApplet() {
// code to setup "object" tag
var appletHtml = '<div id=aplInner' + apltIdCnt + ' <object name= ....'
document.getElementById("applet_tag").innerHTML = appletHtml;
apltIdCnt += 1 ;//or apltIdCnt++
}
this might help if other tags have a different jvm
Upvotes: 0