Package org.apache.commons.launcher
Class ExitOnErrorThreadGroup
- java.lang.Object
-
- java.lang.ThreadGroup
-
- org.apache.commons.launcher.ExitOnErrorThreadGroup
-
- All Implemented Interfaces:
java.lang.Thread.UncaughtExceptionHandler
public class ExitOnErrorThreadGroup extends java.lang.ThreadGroup
A class that subclasses theThreadGroup
class. This class is used byChildMain.main(String[])
to run the target application. By using this class, anyError
other thanThreadDeath
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 theError
and destroy the thread. However, when an uncaughtError
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 Constructor Description ExitOnErrorThreadGroup(java.lang.String name)
Constructs a new thread group.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
uncaughtException(java.lang.Thread t, java.lang.Throwable e)
Trap any uncaughtError
other thanThreadDeath
and exit.-
Methods inherited from class java.lang.ThreadGroup
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString
-
-
-
-
Method Detail
-
uncaughtException
public void uncaughtException(java.lang.Thread t, java.lang.Throwable e)
Trap any uncaughtError
other thanThreadDeath
and exit.- Specified by:
uncaughtException
in interfacejava.lang.Thread.UncaughtExceptionHandler
- Overrides:
uncaughtException
in classjava.lang.ThreadGroup
- Parameters:
t
- the thread that is about to exite
- the uncaught exception
-
-