Package adams.flow.core
Class RunnableWithLogging
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.flow.core.RunnableWithLogging
-
- All Implemented Interfaces:
LoggingLevelHandler,LoggingSupporter,SizeOfHandler,Stoppable,StoppableWithFeedback,Serializable,Runnable
- Direct Known Subclasses:
DelayedActionRunnable,EventRunnable,RemoteFlowListener.ListenerRunnable,RemoteReceiveHandler.AbstractRemoteListenerRunnable,ZipPassword.BruteForceJob
public abstract class RunnableWithLogging extends LoggingObject implements Runnable, StoppableWithFeedback, LoggingLevelHandler
ExtendedRunnableclass that offers logging and can be stopped.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_Runningwhether the runnable is still running.protected booleanm_Stoppedwhether the runnable has been stopped.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description RunnableWithLogging()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoRun()Performs the actual execution.booleanisRunning()Returns whether the runnable is still running.booleanisStopped()Returns whether the runnable has been stopped.protected voidpostRun()Hook method after the run finished.protected voidpreRun()Hook method before the run is started.voidrun()Starts the execution.voidsetLoggingLevel(LoggingLevel value)Sets the logging level.voidstopExecution()Stops the execution.-
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, toString, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
setLoggingLevel
public void setLoggingLevel(LoggingLevel value)
Sets the logging level.- Specified by:
setLoggingLevelin interfaceLoggingLevelHandler- Parameters:
value- the level
-
preRun
protected void preRun()
Hook method before the run is started.
Default implementation does nothing.
-
doRun
protected abstract void doRun()
Performs the actual execution.
-
postRun
protected void postRun()
Hook method after the run finished.
Default implementation does nothing.
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceStoppable
-
isStopped
public boolean isStopped()
Returns whether the runnable has been stopped.- Specified by:
isStoppedin interfaceStoppableWithFeedback- Returns:
- true if stopped
-
isRunning
public boolean isRunning()
Returns whether the runnable is still running.- Returns:
- true if still running
-
-