org.apache.qpid.test.framework.clocksynch
Class ClockSynchThread
java.lang.Object
java.lang.Thread
org.apache.qpid.test.framework.clocksynch.ClockSynchThread
- All Implemented Interfaces:
- Runnable, org.apache.qpid.junit.extensions.ShutdownHookable
public class ClockSynchThread
- extends Thread
- implements org.apache.qpid.junit.extensions.ShutdownHookable
ClockSynchThread is a convenient utility for running a thread that periodically synchronizes the clock against
a reference. Supply it with a ClockSynchronizer
and a Throttle
and it will continually keep the
clock up-to-date at a rate determined by the throttle.
CRC Card
Responsibilities | Collaborations
|
---|
Continually sychronize the clock at a throttled rate.
|
Field Summary |
(package private) boolean |
doSynch
Flag to indicate that the periodic clock syncher should keep running. |
Constructor Summary |
ClockSynchThread(ClockSynchronizer syncher,
org.apache.qpid.junit.extensions.Throttle throttle)
Creates a clock synchronizer thread from a clock synchronizer and a throttle. |
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 |
doSynch
boolean doSynch
- Flag to indicate that the periodic clock syncher should keep running.
ClockSynchThread
public ClockSynchThread(ClockSynchronizer syncher,
org.apache.qpid.junit.extensions.Throttle throttle)
- Creates a clock synchronizer thread from a clock synchronizer and a throttle.
- Parameters:
syncher
- The clock synchronizer.throttle
- The throttle.
terminate
public void terminate()
- Terminates the synchronization thread.
run
public void run()
- Continually updates the clock, until
terminate()
is called.
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
getClockSyncher
public ClockSynchronizer getClockSyncher()
- Gets the clock synchronizer that is kept continually up to date.
- Returns:
- The clock synchronizer that is kept continually up to date.
getShutdownHook
public Thread getShutdownHook()
- Supplies a shutdown hook, that terminates the synching thread.
- Specified by:
getShutdownHook
in interface org.apache.qpid.junit.extensions.ShutdownHookable
- Returns:
- The shut down hook.
Licensed to the Apache Software Foundation