Package adams.core.shutdown
Class AbstractShutdownHook
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.shutdown.AbstractShutdownHook
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,Serializable
public abstract class AbstractShutdownHook extends AbstractOptionHandler
Ancestor for shutdown hooks for the JVM.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Threadm_Hookthe installed hook.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractShutdownHook()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Stringcheck()Hook method before generating the runnable and installing it.abstract Runnableconfigure()Configures the runnable that gets executed when shutting down.Stringinstall()Installs the hook, if possible.booleanremove()Removes the hook, if possible.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Hook
protected Thread m_Hook
the installed hook.
-
-
Method Detail
-
check
public String check()
Hook method before generating the runnable and installing it.
Default implementation just returns null.- Returns:
- null if successful, otherwise error message
-
configure
public abstract Runnable configure()
Configures the runnable that gets executed when shutting down.- Returns:
- the runnable
-
install
public String install()
Installs the hook, if possible.- Returns:
- null if successful, otherwise error message
-
remove
public boolean remove()
Removes the hook, if possible.- Returns:
- true if successfully removed (or not installed)
-
-