Skip to main content

Lengthy destroy/stop event causes ThreadDeath in JRE6u10

4 replies [Last post]
jphenning
Offline
Joined: 2008-11-18
Points: 0

I have an signed applet compiled against JDK1.5. It connects to a database (SQL Server) and when the user leaves the page it needs to save the data automatically. Because the amount of data is rather large the operation takes a while. I've placed the save code in the applet's "destroy" method (although i've tried the "stop" event too). This worked fine until I upgraded to JDK1.6 Update 10. I now get a "ThreadDeath" exception and my save code never continues running. I've disabled all the save code and just places a 10second thread delay to simulate a lengthy save operation and I still get a "ThreadDeath" exception. If i turn off the "Enable the next generation Java plug-in" in the Java Control Panel, my applet works perfect. Unfortunately this is not really an option as my applet will be used by a number of people over the web and it would not be nice to first ask them to mess around in the Java Control Panel to get the applet to work. Does anybody have any suggestions? It seems that the new plugin just zaps the lengthy code, not allowing the destroy or stop events to continue. I can understand if the code took a couple of minutes to run, but not a few seconds?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
demonduck
Offline
Joined: 2008-03-14
Points: 0

Did you see the thread that briefly talked about applet lifecycles? It turns out that
there are now two applet lifecycles. The default lifecycle that calls init()/start() and
stop()/destroy() and the so called "legacy_lifecycle" that calls init(); start(); stop() and
destroy() as separate method calls

The gist of it is that if you put:

in your applet tag, you get the old lifecycle.

Here's the thread:

http://forums.java.net/jive/thread.jspa?threadID=52873&tstart=0

jphenning
Offline
Joined: 2008-11-18
Points: 0

Hi, thanks for pointing that out. I did not see that. Unfortunately that did not solve my problem. I still get the same problem.

zappen
Offline
Joined: 2006-03-10
Points: 0

Hi!

I'm facing the same problem. When running in the applet viewer everthing works well for me. However running there isn't the same at all as running within a browser, so that fact doesn't help very much.

If you find any info on this matter or come to some solution or whatever, I'm really interested in getting this info.

jphenning
Offline
Joined: 2008-11-18
Points: 0

Hi,

You can trace it here:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6773082

Unfortunately the new design of the Java Plugin in Update 10 is designed in such a way to allow speady closure of the applet. Not good news for me.