Name
Thread.UncaughtExceptionHandler
Synopsis
This
interface defines a handler to be invoked when a thread throws an
exception that remains uncaught. When
this happens, the uncaughtException(
)
method of the registered handler is
invoked with the Thread object that threw the
exception and the Throwable exception object as
arguments. The handler is run by the thread that received the
exception, and that thread will exit as soon as the handler exits. If
uncaughtException( ) itself throws an exception,
that exception will be ignored.
An object that implements this interface may be registered for a
Thread with the
setUncaughtExceptionHandler(
)
method. A default
UncaughtExceptionHandler may be registered with
the static method Thread.setDefaultUncaughtExceptionHandler(
)
. If no handler or default handler is
registered, the uncaughtException( ) method of the
containing ThreadGroup is used instead.
public interface Thread.UncaughtExceptionHandler { // Public Instance Methods void uncaughtException(Thread t, Throwable e); }
Implementations
ThreadGroup
Passed To
Thread.{setDefaultUncaughtExceptionHandler( ),
setUncaughtExceptionHandler( )}
Returned By
Thread.{getDefaultUncaughtExceptionHandler( ),
getUncaughtExceptionHandler( )}
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access