com.monkeycoder.monkeynetwork
Class ConnectionTimeOutTimer

java.lang.Object
  extended by com.monkeycoder.monkeynetwork.ConnectionTimeOutTimer

public class ConnectionTimeOutTimer
extends java.lang.Object

This class acts as a pollable countdown timer.

Author:
David Stephens

Constructor Summary
ConnectionTimeOutTimer()
          Creates a new ConnectionTimeOutTimer.
ConnectionTimeOutTimer(boolean autoStart)
          Creates a new ConnectionTimeOutTimer.
ConnectionTimeOutTimer(boolean autoStart, long inTimeoutTime)
          Creates a new ConnectionTimeOutTimer.
 
Method Summary
 boolean isTimedOut()
          Checks whether or not this timer has expired.
 void setTimeoutTime(long inTimeoutTime)
          Sets how long until this timer reports that it has timed out.
 void start()
          Starts the timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionTimeOutTimer

public ConnectionTimeOutTimer()
Creates a new ConnectionTimeOutTimer. This version defaults the timeout time to 5 seconds and does not automatically start after creation.


ConnectionTimeOutTimer

public ConnectionTimeOutTimer(boolean autoStart)
Creates a new ConnectionTimeOutTimer. This version defaults the timeout time to 5 seconds and starts the timer if instructed to do so after creation.

Parameters:
autoStart - Whether or not to start this timer immediately after its creation.

ConnectionTimeOutTimer

public ConnectionTimeOutTimer(boolean autoStart,
                              long inTimeoutTime)
Creates a new ConnectionTimeOutTimer. This version defaults the timeout time to 5 seconds and starts the timer if instructed to do so after creation.

Parameters:
autoStart - Whether or not to start this timer immediately after its creation.
inTimeoutTime - How long until this timer reports that it has timed out in milliseconds.
Method Detail

start

public void start()
Starts the timer. Also serves to reset the timer.


setTimeoutTime

public void setTimeoutTime(long inTimeoutTime)
Sets how long until this timer reports that it has timed out.

Parameters:
inTimeoutTime - How long until this timer reports that it has timed out in miliseconds.

isTimedOut

public boolean isTimedOut()
Checks whether or not this timer has expired.

Returns:
Whether or not the timer has expired.