Package org.apache.commons.launcher
Class ExitOnErrorThreadGroup
java.lang.Object
java.lang.ThreadGroup
org.apache.commons.launcher.ExitOnErrorThreadGroup
- All Implemented Interfaces:
Thread.UncaughtExceptionHandler
A class that subclasses the
ThreadGroup
class. This class is used
by ChildMain.main(String[])
to run the target application. By using
this class, any Error
other than ThreadDeath
thrown by
threads created by the target application will be caught the process
terminated. By default, the JVM will only print a stack trace of the
Error
and destroy the thread. However, when an uncaught
Error
occurs, it normally means that the JVM has encountered a
severe problem. Hence, an orderly shutdown is a reasonable approach.
Note: not all threads created by the target application are guaranteed to
use this class. Target application's may bypass this class by creating a
thread using the Thread(ThreadGroup, String)
or other similar
constructors.
- Author:
- Patrick Luby
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
uncaughtException
(Thread t, Throwable e) Trap any uncaughtError
other thanThreadDeath
and exit.Methods inherited from class java.lang.ThreadGroup
activeCount, activeGroupCount, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString
-
Constructor Details
-
ExitOnErrorThreadGroup
Constructs a new thread group. The parent of this new group is the thread group of the currently running thread.- Parameters:
name
- the name of the new thread group
-
-
Method Details
-
uncaughtException
Trap any uncaughtError
other thanThreadDeath
and exit.- Specified by:
uncaughtException
in interfaceThread.UncaughtExceptionHandler
- Overrides:
uncaughtException
in classThreadGroup
- Parameters:
t
- the thread that is about to exite
- the uncaught exception
-