java.lang
public interface Thread.UncaughtExceptionHandler
This interface is used to handle uncaught exceptions
which cause a Thread
to terminate. When
a thread, t, is about to terminate due to an uncaught
exception, the virtual machine looks for a class which
implements this interface, in order to supply it with
the dying thread and its uncaught exception.
The virtual machine makes two attempts to find an appropriate handler for the uncaught exception, in the following order:
t.getUncaughtExceptionHandler()
--
the dying thread is queried first for a handler
specific to that thread.
t.getThreadGroup()
--
the thread group of the dying thread is used to
handle the exception. If the thread group has
no special requirements for handling the exception,
it may simply forward it on to
Thread.getDefaultUncaughtExceptionHandler()
,
the default handler, which is used as a last resort.
The first handler found is the one used to handle the uncaught exception.
Since: 1.5
See Also: getUncaughtExceptionHandler setUncaughtExceptionHandler getDefaultUncaughtExceptionHandler setDefaultUncaughtExceptionHandler
Method Summary | |
---|---|
void | uncaughtException(Thread thr, Throwable exc)
Invoked by the virtual machine with the dying thread
and the uncaught exception. |
Parameters: thr the dying thread. exc the uncaught exception.