< prev index next >

src/java.base/share/classes/java/lang/ThreadDeath.java

Print this page




  30  * when the (deprecated) {@link Thread#stop()} method is invoked.
  31  *
  32  * <p>An application should catch instances of this class only if it
  33  * must clean up after being terminated asynchronously.  If
  34  * {@code ThreadDeath} is caught by a method, it is important that it
  35  * be rethrown so that the thread actually dies.
  36  *
  37  * <p>The {@linkplain ThreadGroup#uncaughtException top-level error
  38  * handler} does not print out a message if {@code ThreadDeath} is
  39  * never caught.
  40  *
  41  * <p>The class {@code ThreadDeath} is specifically a subclass of
  42  * {@code Error} rather than {@code Exception}, even though it is a
  43  * "normal occurrence", because many applications catch all
  44  * occurrences of {@code Exception} and then discard the exception.
  45  *
  46  * @since   1.0
  47  */
  48 
  49 public class ThreadDeath extends Error {

  50     private static final long serialVersionUID = -4417128565033088268L;
  51 }


  30  * when the (deprecated) {@link Thread#stop()} method is invoked.
  31  *
  32  * <p>An application should catch instances of this class only if it
  33  * must clean up after being terminated asynchronously.  If
  34  * {@code ThreadDeath} is caught by a method, it is important that it
  35  * be rethrown so that the thread actually dies.
  36  *
  37  * <p>The {@linkplain ThreadGroup#uncaughtException top-level error
  38  * handler} does not print out a message if {@code ThreadDeath} is
  39  * never caught.
  40  *
  41  * <p>The class {@code ThreadDeath} is specifically a subclass of
  42  * {@code Error} rather than {@code Exception}, even though it is a
  43  * "normal occurrence", because many applications catch all
  44  * occurrences of {@code Exception} and then discard the exception.
  45  *
  46  * @since   1.0
  47  */
  48 
  49 public class ThreadDeath extends Error {
  50     @java.io.Serial
  51     private static final long serialVersionUID = -4417128565033088268L;
  52 }
< prev index next >