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.ThreadGroupA class that subclasses theThreadGroupclass. This class is used byChildMain.main(String[])to run the target application. By using this class, anyErrorother thanThreadDeaththrown by threads created by the target application will be caught the process terminated. By default, the JVM will only print a stack trace of theErrorand destroy the thread. However, when an uncaughtErroroccurs, 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 voiduncaughtException(java.lang.Thread t, java.lang.Throwable e)Trap any uncaughtErrorother thanThreadDeathand 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 uncaughtErrorother thanThreadDeathand exit.- Specified by:
uncaughtExceptionin interfacejava.lang.Thread.UncaughtExceptionHandler- Overrides:
uncaughtExceptionin classjava.lang.ThreadGroup- Parameters:
t- the thread that is about to exite- the uncaught exception
-
-