org.appdapter.module.basic
Class TimedModule<Mlator extends Modulator>

java.lang.Object
  extended by org.appdapter.core.log.BasicDebugger
      extended by org.appdapter.module.basic.BasicModule<Mlator>
          extended by org.appdapter.module.basic.TimedModule<Mlator>
All Implemented Interfaces:
Module<Mlator>
Direct Known Subclasses:
EmptyTimedModule

public abstract class TimedModule<Mlator extends Modulator>
extends BasicModule<Mlator>

Here we log the timing of each callback exec, and also make the parent modulator's presence explicit in each callback. We also supply a naive "completed run count".

Author:
Stu B.

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.appdapter.api.module.Module
Module.State
 
Field Summary
protected  int myRunDebugModulus
           
 
Fields inherited from class org.appdapter.core.log.BasicDebugger
IMPO_HI, IMPO_HIHI, IMPO_LO, IMPO_LOLO, IMPO_MAX, IMPO_MIN, IMPO_NORM
 
Constructor Summary
TimedModule()
           
 
Method Summary
protected abstract  void doInit(Mlator mlator)
           
protected abstract  void doRelease(Mlator mlator)
           
protected abstract  void doRunOnce(Mlator mlator, long runSeqNum)
           
protected abstract  void doStart(Mlator mlator)
           
protected abstract  void doStop(Mlator mlator)
           
 long getCompletedRunCount()
           
 String getDescription()
           
 void initModule()
          Modulator must be set when initModule is called.
 void releaseModule()
          Required pre-state is POST_STOP_OR_FAILED_STARTUP.
 void runOnce()
          Required pre-state is WAIT_TO_RUN_OR_STOP.
 void start()
          Required pre-state is WAIT_TO_START.
 void stop()
          Required pre-state is WAIT_TO_RUN_OR_STOP.
 
Methods inherited from class org.appdapter.module.basic.BasicModule
enterBasicInitModule, enterBasicReleaseModule, enterBasicRunOnce, enterBasicStart, enterBasicStop, exitBasicInitModule, exitBasicReleaseModule, exitBasicRunOnce, exitBasicStart, exitBasicStop, failDuringInitOrStartup, getParentModulator, getState, isStopRequested, markStopRequested, notifyStateViolation, setParentModulator, toString, verifyStoredState
 
Methods inherited from class org.appdapter.core.log.BasicDebugger
checkDebugImportance, getLogger, isLoggerUsable, logError, logInfo, logInfo, logInfoEvent, setDebugImportanceThreshold, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myRunDebugModulus

protected int myRunDebugModulus
Constructor Detail

TimedModule

public TimedModule()
Method Detail

getCompletedRunCount

public long getCompletedRunCount()

doInit

protected abstract void doInit(Mlator mlator)

initModule

public void initModule()
Description copied from interface: Module
Modulator must be set when initModule is called. initModule is called exactly once, by the modulator, and can be First method called on Module, and called only once. Can only be called by the modulatorModule Upon return, must be in WAIT_TO_START, or or POST_STOP_OR_FAILED_STARTUP.


doStart

protected abstract void doStart(Mlator mlator)

start

public void start()
Description copied from interface: Module
Required pre-state is WAIT_TO_START. During-state is IN_START Upon return, state is WAIT_TO_RUN_OR_STOP, or POST_STOP_OR_FAILED_STARTUP.


doRunOnce

protected abstract void doRunOnce(Mlator mlator,
                                  long runSeqNum)

runOnce

public void runOnce()
Description copied from interface: Module
Required pre-state is WAIT_TO_RUN_OR_STOP. During-state is IN_RUN. Upon return, state is WAIT_TO_RUN_OR_STOP.


doStop

protected abstract void doStop(Mlator mlator)

stop

public void stop()
Description copied from interface: Module
Required pre-state is WAIT_TO_RUN_OR_STOP. During-state is IN_STOP. Upon return, state is POST_STOP_OR_FAILED_STARTUP.


doRelease

protected abstract void doRelease(Mlator mlator)

releaseModule

public void releaseModule()
Description copied from interface: Module
Required pre-state is POST_STOP_OR_FAILED_STARTUP. Module is no longer usable as soon as call begins. Should not throw.


getDescription

public String getDescription()
Overrides:
getDescription in class BasicModule<Mlator extends Modulator>


Copyright © 2010-2012. All Rights Reserved.