tyrex.services
public class DaemonMaster extends ThreadGroup implements Runnable
A daemon thread is a thread that is kept live for the duration of the server's life and is only terminated when the server is stopped.
A sudden termination of a daemon thread is an unwelcome occurance in the life time of the system. The daemon master protects the system from the sudden and unexpected termination of daemons by automatically restarting them.
A daemon implements the Runnable interface which allows it to be executed on any given thread. The daemon master assigns a thread within the daemon master's thread group. If the daemon is suddently terminated, the daemon master will be informed and attempt to restart the daemon with a new thread.
The daemon master is thread-safe and consumes a single thread.
Version: $Revision: 1.6 $
Method Summary | |
---|---|
static void | addDaemon(Runnable runnable, String name)
Adds a daemon. |
static void | addDaemon(Runnable runnable, String name, int priority)
Adds a daemon. |
static void | dump(PrintWriter writer) |
static int | getCount()
Returns the number of daemons currently in the system.
|
static boolean | removeDaemon(Runnable runnable)
Removes a daemon. |
void | run() |
void | uncaughtException(Thread thread, Throwable thrw) |
Parameters: runnable The runnable object name The daemon name
Parameters: runnable The runnable object name The daemon name priority The thread priority
Returns: The number of daemons currently in the system
Parameters: runnable The runnable object