org.apache.commons.launcher

Class ExitOnErrorThreadGroup

public class ExitOnErrorThreadGroup extends ThreadGroup

A class that subclasses the {@link ThreadGroup} class. This class is used by {@link ChildMain#main(String[])} to run the target application. By using this class, any {@link Error} other than {@link 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 {@link Error} and destroy the thread. However, when an uncaught {@link 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 {@link Thread#Thread(ThreadGroup, String)} or other similar constructors.

Author: Patrick Luby

Constructor Summary
ExitOnErrorThreadGroup(String name)
Constructs a new thread group.
Method Summary
voiduncaughtException(Thread t, Throwable e)
Trap any uncaught {@link Error} other than {@link ThreadDeath} and exit.

Constructor Detail

ExitOnErrorThreadGroup

public ExitOnErrorThreadGroup(String name)
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 Detail

uncaughtException

public void uncaughtException(Thread t, Throwable e)
Trap any uncaught {@link Error} other than {@link ThreadDeath} and exit.

Parameters: t the thread that is about to exit e the uncaught exception

Copyright (c) 2001-2002 - Apache Software Foundation