com.sssw.fw.timer
Class EboTimerFactory
java.lang.Object
|
+--java.lang.Thread
|
+--com.sssw.fw.timer.EboTimerFactory
- All Implemented Interfaces:
- Runnable
- public class EboTimerFactory
- extends Thread
Factory for allocating a timer. When you allocate a timer,
you need an instance of your own handler class that implements EbiTimerHandler.
To get a factory instance and allocate a timer, use code like this:
MyTimerHandler myhandler = new MyTimerHandler();
fw.timer.EboTimerFactory timerFactory = new EboTimerFactory("My Timer Factory");
EbiTimer timer = timerFactory.allocateTimer((EbiTimerHandler) myhandler);
The String argument for the EboTimerFactory constructor is an application-defined thread name.
Each timer runs in a separate thread.
- See Also:
EbiTimer
,
EbiTimerHandler
Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
run,
setContextClassLoader,
setDaemon,
setName,
setPriority,
sleep,
sleep,
start,
stop,
stop,
suspend,
toString,
yield |
EboTimerFactory
public EboTimerFactory()
allocateTimer
public EbiTimer allocateTimer(EbiTimerHandler handler)
- Allocates a Timer object but does not register for a timeExpired() event.
You can use the timer's register() method later to request the event.
- Parameters:
handler
- An EbiTimerHandler object whose timeExpired() method
is called each time a registered interval elapses.- Returns:
- An EbiTimer object.
allocateTimer
public EbiTimer allocateTimer(EbiTimerHandler handler,
long interval,
Object userobject)
- Allocates a Timer object and registers for a timeExpired() event.
- Parameters:
handler
- An EbiTimerHandler object whose timeExpired() method
is called each time a registered interval elapses.interval
- The time in milliseconds until the handler's
timeExpired() method is called.userobject
- An object you want to associate with the timer notification.
For example, you might store the current context when you register an interval
and retrieve it (using the getUserObject() method of the EbiTimer) when the
time expires. This can be useful when using a single handler to manage a set of
timers.- Returns:
- An EbiTimer object.