|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
kaos.metrics.TaskTimer
public class TaskTimer
This is a generic timer used by other classes. An instance of TaskTimer is given a callback (any object implementing the TimerCallBack interface) which is called everytime the timer expires. The length of the timer is a millisecond value set in the constructor or directly. The timer uses a separate thread for execution by extending the default Thread.
TimerCallBack| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static long |
MINIMUM_TIMER_INTERVAL
The minimum allowed value of the timer interval. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
TaskTimer()
Default constructor creates a TaskTimer with not established call back objects. |
|
TaskTimer(long pTimerInterval)
Construct a TaskTimer object with the specified timer setting. |
|
TaskTimer(java.lang.String pThreadName,
long pTimerInterval)
Construct a TaskTimer object with the specified timer name and timer setting. |
|
TaskTimer(TimerCallBack pCallBack)
Construct a TaskTimer object with the specified call back. |
|
TaskTimer(TimerCallBack pCallBack,
java.lang.String pThreadName,
long pTimerInterval)
Construct a TaskTimer object with the specified call back, name, and timer setting. |
|
| Method Summary | |
|---|---|
void |
addTimerCallBack(TimerCallBack pCallBack)
Adds an object that will be called each iteration of the timer. |
long |
getTimerInterval()
|
void |
killTimer()
Stops the timer and clears all references to call back items. |
void |
removeTimerCallBack(TimerCallBack pCallBack)
Removes an existing timer call back object from the available call back list. |
void |
run()
Main timer loop runs until shutdown command is received. |
void |
setTimerInterval(long pTimerInterval)
Set the timer interval. |
void |
stopTimer()
This stops the timer, after the current interval expires. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, 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, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long MINIMUM_TIMER_INTERVAL
| Constructor Detail |
|---|
public TaskTimer()
public TaskTimer(long pTimerInterval)
pTimerInterval - millisecond interval value.
public TaskTimer(java.lang.String pThreadName,
long pTimerInterval)
pThreadName - name for this thread.pTimerInterval - millisecond interval value.
public TaskTimer(TimerCallBack pCallBack,
java.lang.String pThreadName,
long pTimerInterval)
pCallBack - Object implementing the TimerCallBack interface that is
to be called each time the timer expires.pThreadName - name for this thread.pTimerInterval - millisecond interval value.public TaskTimer(TimerCallBack pCallBack)
pCallBack - Object implementing the TimerCallBack interface that is
to be called each time the timer expires.| Method Detail |
|---|
public long getTimerInterval()
public void setTimerInterval(long pTimerInterval)
pTimerInterval - Interval value in milliseconds, if less than
MINIMUM_TIMER_INTERVAL then timer will be set equal
to the minimum.public void addTimerCallBack(TimerCallBack pCallBack)
pCallBack - Object to be called each time the timer expires.public void removeTimerCallBack(TimerCallBack pCallBack)
pCallBack - Object to be called each time the timer expires.public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void stopTimer()
public void killTimer()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||