org.apache.james.util.watchdog
Class InaccurateTimeoutWatchdog

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.util.watchdog.InaccurateTimeoutWatchdog
All Implemented Interfaces:
java.lang.Runnable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, Watchdog

public class InaccurateTimeoutWatchdog
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements Watchdog, java.lang.Runnable, org.apache.avalon.framework.activity.Disposable

This class represents an watchdog process that serves to monitor a situation and triggers an action after a certain time has passed. This implementation is deliberately inaccurate, trading accuracy for minimal impact on reset. This should be used when the time of the Watchdog trigger is not critical, and a high number of resets are expected.


Constructor Summary
InaccurateTimeoutWatchdog(long timeout, WatchdogTarget target, org.apache.excalibur.thread.ThreadPool threadPool)
          The sole constructor for the InaccurateTimeoutWatchdog
 
Method Summary
 void dispose()
           
 void reset()
          Reset this Watchdog.
 void run()
          Execute the body of the Watchdog, triggering as appropriate.
 void start()
          Start this Watchdog, causing it to begin checking.
 void stop()
          Stop this Watchdog, causing the Watchdog to stop checking the trigger condition.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InaccurateTimeoutWatchdog

public InaccurateTimeoutWatchdog(long timeout,
                                 WatchdogTarget target,
                                 org.apache.excalibur.thread.ThreadPool threadPool)
The sole constructor for the InaccurateTimeoutWatchdog

Parameters:
timeout - the time (in msec) that it will take the Watchdog to timeout
target - the WatchdogTarget to be executed when this Watchdog expires
threadPool - the thread pool used to generate threads for this implementation.
Method Detail

start

public void start()
Start this Watchdog, causing it to begin checking.

Specified by:
start in interface Watchdog

reset

public void reset()
Reset this Watchdog. Tells the Watchdog thread to reset the timer when it next awakens.

Specified by:
reset in interface Watchdog

stop

public void stop()
Stop this Watchdog, causing the Watchdog to stop checking the trigger condition. The monitor can be restarted with a call to startWatchdog.

Specified by:
stop in interface Watchdog

run

public void run()
Execute the body of the Watchdog, triggering as appropriate.

Specified by:
run in interface java.lang.Runnable

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.