ThreadEx.setDefaultUncaughtExceptionHandler

Set the default handler invoked when a thread abruptly terminates due to an uncaught exception, and no other handler has been defined for that thread.

<p>Uncaught exception handling is controlled first by the thread, then by the thread's {@link ThreadGroup} object and finally by the default uncaught exception handler. If the thread does not have an explicit uncaught exception handler set, and the thread's thread group (including parent thread groups) does not specialize its {@code uncaughtException} method, then the default handler's {@code uncaughtException} method will be invoked. <p>By setting the default uncaught exception handler, an application can change the way in which uncaught exceptions are handled (such as logging to a specific device, or file) for those threads that would already accept whatever &quot;default&quot; behavior the system provided.

<p>Note that the default uncaught exception handler should not usually defer to the thread's {@code ThreadGroup} object, as that could cause infinite recursion.

@param eh the object to use as the default uncaught exception handler. If {@code null} then there is no default handler.

@throws SecurityException if a security manager is present and it denies {@link RuntimePermission}{@code ("setDefaultUncaughtExceptionHandler")}

@see #setUncaughtExceptionHandler @see #getUncaughtExceptionHandler @see ThreadGroup#uncaughtException

class ThreadEx
static
void
setDefaultUncaughtExceptionHandler

Meta