When the Wrapper detects that
System.exit() has been
called, it will call the
stop() method on your
application if it implements the WrapperListener method.
You must be careful that your application does not call
System.exit() again or call
the dispose() method on an
AWT frame or window. Either one of these actions will result
in a deadlock when called from within a ShutdownHook thread
due to the way Java has implemented these methods. If
either of these cases can not be avoided, then the shutdown
hook should be disabled.
If you have control over whether the
System.exit() or
dispose() methods are
called, you may be able to make use of the
WrapperManager.hasShutdownHookBeenTriggered()
method to avoid the deadlock issue.
For more information on the AWT deadlock bug, see the full
description of
bug #4712342
on Sun's site.
|