public class ShutdownMonitor
extends java.lang.Thread
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.Boolean |
executeEndCode
Stores whether the end code shall be executed.
|
private java.lang.String |
invoke
Stores the static method to be invoked at the end of monitoring.
|
private java.lang.ClassLoader |
loader
Stores the class loader for invoking
invoke. |
private boolean |
printStatistics
Whether final statistics shall be printed.
|
| Constructor and Description |
|---|
ShutdownMonitor(java.lang.ClassLoader loader,
java.lang.String invoke)
Creates a new monitor.
|
ShutdownMonitor(java.lang.ClassLoader loader,
java.lang.String invoke,
boolean printStatistics)
Creates a new monitor.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
endMonitoring(boolean printStatistics,
java.lang.ClassLoader loader,
java.lang.String invoke)
Ends the monitoring system properly.
|
static void |
endSystemNotification()
Notifies that final end of monitoring occured.
|
private static void |
handleException(java.lang.String invoke,
java.lang.Exception exception)
Emits an exception.
|
void |
run()
Ends the monitoring.
|
static void |
setWaitEndSystemNotification(boolean wait)
Enables explicit waiting for end system notification (by
endSystemNotification()). |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldprivate static java.lang.Boolean executeEndCode
false wait, true execute.private java.lang.String invoke
private java.lang.ClassLoader loader
invoke.private boolean printStatistics
public ShutdownMonitor(java.lang.ClassLoader loader,
java.lang.String invoke)
invoke - the static method to be invokedloader - the related class loader for invocationpublic ShutdownMonitor(java.lang.ClassLoader loader,
java.lang.String invoke,
boolean printStatistics)
invoke - the static method to be invokedloader - the related class loader for invocationprintStatistics - whether statistics shall be printedpublic static void setWaitEndSystemNotification(boolean wait)
endSystemNotification()). This mechanism should not be used
when this class is used as a JVM shutdown hook!wait - if true end system notification is required
to shut down monitoring, if false the system just existspublic static void endSystemNotification()
public static void endMonitoring(boolean printStatistics,
java.lang.ClassLoader loader,
java.lang.String invoke)
printStatistics - determines if statistics should be printedloader - the class loader for invokeinvoke - a static method to be invoked after finishing monitoring
(in the form fqn class name "." method name, no parameter)private static void handleException(java.lang.String invoke,
java.lang.Exception exception)
invoke - the method to invokeexception - the caught exceptionpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Thread