On 2/08/2014 11:40 PM, Harshad RJ wrote:
Hi,

I hit this bug in my own application today:
https://bugs.openjdk.java.net/browse/JDK-8042694

My app uses the h2 database which installs a shutdown hook. Works fine, but
while running with JNLP, the shutdown hook thrown an exception, probably
because the JAR gets closed too early.

I can't find a way to register on the JIRA site, hence posting here.

I would like to know why was the bug closed as "won't fix"?

Not speaking for the webstart folk.

ShutdownHooks are generally very problematic so issues like this are not surprising. There's no guarantee that a shutdown hook thread can access any "system" services like submitting to the AWT-Event thread, using logging, or even (as seems in this case) loading a new class. Trying to make system services work better with hooks is sometimes possible but also generally very difficult and error-prone. Generally hooks should be written to do as little as possible, relying on as few external services as possible, and always anticipating failure. It may be that a shutdown hook is not the right mechanism for cleaning up the library in this case - perhaps it needs to be done explicitly when the app detects that it is required to terminate.

Just my 2c.

David

​thanks,​

Reply via email to