no.priv.garshol.duke.server
Class CommonJTimer

java.lang.Object
  extended by no.priv.garshol.duke.server.CommonJTimer
All Implemented Interfaces:
commonj.timers.TimerListener, DukeTimer

public class CommonJTimer
extends Object
implements DukeTimer, commonj.timers.TimerListener

Timer implementation which uses the JSR-236 API, in order to provide managed threads within servlet containers that support them.


Constructor Summary
CommonJTimer()
           
 
Method Summary
 void init(Properties props)
          Initializes the timer, giving it access to configuration settings.
 boolean isRunning()
          Returns true iff the background thread is running.
 void spawnThread(DukeController controller, int check_interval)
          Starts a background thread which calls the controller every check_interval milliseconds.
 void stop()
          Stops the background thread.
 void timerExpired(commonj.timers.Timer timer)
          This is the callback from the timer service, letting us know it's time do something.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonJTimer

public CommonJTimer()
Method Detail

init

public void init(Properties props)
Description copied from interface: DukeTimer
Initializes the timer, giving it access to configuration settings.

Specified by:
init in interface DukeTimer

spawnThread

public void spawnThread(DukeController controller,
                        int check_interval)
Starts a background thread which calls the controller every check_interval milliseconds. Returns immediately, leaving the background thread running.

Specified by:
spawnThread in interface DukeTimer

isRunning

public boolean isRunning()
Returns true iff the background thread is running.

Specified by:
isRunning in interface DukeTimer

stop

public void stop()
Stops the background thread. It can be restarted with a new call to spawnThread.

Specified by:
stop in interface DukeTimer

timerExpired

public void timerExpired(commonj.timers.Timer timer)
This is the callback from the timer service, letting us know it's time do something.

Specified by:
timerExpired in interface commonj.timers.TimerListener


Copyright © 2013. All Rights Reserved.