info.jonclark.util
Class Timeout

java.lang.Object
  extended by info.jonclark.util.Timeout

public class Timeout
extends Object

A simple way of determining if a task has timed out. If the length of time specified by millis passes without the refresh() method being called then all TimeoutListeneres are notified that the task has become stale.


Constructor Summary
Timeout()
           
 
Method Summary
 void addTimeoutListener(TimeoutListener t)
          Adds a listener that will be notified of timeouts
 void cancel()
          Disables this timeout
 void refresh()
          Notifies the timer that the task is not stalled so that the timeout will not fire.
 void setTimeout(long timeoutMillis)
          Set the timeout for this timeout using the default resolution.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timeout

public Timeout()
Method Detail

setTimeout

public void setTimeout(long timeoutMillis)
Set the timeout for this timeout using the default resolution.

Parameters:
timeoutMillis -

cancel

public void cancel()
Disables this timeout


refresh

public void refresh()
Notifies the timer that the task is not stalled so that the timeout will not fire.


addTimeoutListener

public void addTimeoutListener(TimeoutListener t)
Adds a listener that will be notified of timeouts

Parameters:
t - The TimeoutListener that will be notified