Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.lang
Interface Thread.UncaughtExceptionHandler  view Thread.UncaughtExceptionHandler download Thread.UncaughtExceptionHandler.java

All Known Implementing Classes:
ThreadGroup
Enclosing interface:
Thread

public static 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:

  1. t.getUncaughtExceptionHandler() -- the dying thread is queried first for a handler specific to that thread.
  2. 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

Method Summary
 void uncaughtException(Thread thr, Throwable exc)
          Invoked by the virtual machine with the dying thread and the uncaught exception.
 

Method Detail

uncaughtException

public void uncaughtException(Thread thr,
                              Throwable exc)
Invoked by the virtual machine with the dying thread and the uncaught exception. Any exceptions thrown by this method are simply ignored by the virtual machine.