-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
6
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
EventQueue.invokeLater() and EventQueue.invokeAndWait() should throw an exception in case it is invoked from a shutdown thread.
This exception should be documented and become part of the new spec (so yes, we're modifying the API specification) but I don't think that this is breaking backwards compatibility because the current behavior is that instead of throwing an exception a deadlock will occur.
JUSTIFICATION :
If an application registers a shutdown hook, it is able to know not to rely on the EventQueue (i.e. don't invoke JFrame.dispose()) but 3rd party libraries have absolutely no way of finding out whether they're running inside a shutdown hook or not.
The only way to prevent deadlocks from occuring is to throw an exception which signals that we're inside a shutdown hook (or the EventQueue is otherwise unavailable).
This will allow libraries to catch the exception and continue shutting down without interacting with AWT components. For example, temporarily files can be removed, etc... without closing windows.
EventQueue.invokeLater() and EventQueue.invokeAndWait() should throw an exception in case it is invoked from a shutdown thread.
This exception should be documented and become part of the new spec (so yes, we're modifying the API specification) but I don't think that this is breaking backwards compatibility because the current behavior is that instead of throwing an exception a deadlock will occur.
JUSTIFICATION :
If an application registers a shutdown hook, it is able to know not to rely on the EventQueue (i.e. don't invoke JFrame.dispose()) but 3rd party libraries have absolutely no way of finding out whether they're running inside a shutdown hook or not.
The only way to prevent deadlocks from occuring is to throw an exception which signals that we're inside a shutdown hook (or the EventQueue is otherwise unavailable).
This will allow libraries to catch the exception and continue shutting down without interacting with AWT components. For example, temporarily files can be removed, etc... without closing windows.
- relates to
-
JDK-6546068 system hangs when calling TrayIcon.setToolTip in shutdown hook
- Closed
-
JDK-6261550 (spec) Runtime.addShutdownHook should warn against depending upon other threads
- Resolved