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
ExtendedRunnable
class 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 boolean
m_Running
whether the runnable is still running.protected boolean
m_Stopped
whether 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 void
doRun()
Performs the actual execution.boolean
isRunning()
Returns whether the runnable is still running.boolean
isStopped()
Returns whether the runnable has been stopped.protected void
postRun()
Hook method after the run finished.protected void
preRun()
Hook method before the run is started.void
run()
Starts the execution.void
setLoggingLevel(LoggingLevel value)
Sets the logging level.void
stopExecution()
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:
setLoggingLevel
in 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:
stopExecution
in interfaceStoppable
-
isStopped
public boolean isStopped()
Returns whether the runnable has been stopped.- Specified by:
isStopped
in interfaceStoppableWithFeedback
- Returns:
- true if stopped
-
isRunning
public boolean isRunning()
Returns whether the runnable is still running.- Returns:
- true if still running
-
-