test
Class Timer

java.lang.Object
  extended by java.lang.Thread
      extended by test.Timer
All Implemented Interfaces:
java.lang.Runnable

public class Timer
extends java.lang.Thread

The Timer class allows a graceful exit when an application is stalled due to a networking timeout. Once the timer is set, it must be cleared via the reset() method, or the timeout() method is called. The timeout length is customizable, by changing the 'length' property, or through the constructor. The length represents the length of the timer in milliseconds.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Timer(int length)
          Creates a timer of a specified length
 
Method Summary
 void reset()
          Resets the timer back to zero
 void run()
          Performs timer specific code
 void timeout()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Timer

public Timer(int length)
Creates a timer of a specified length

Parameters:
length - Length of time before timeout occurs
Method Detail

reset

public void reset()
Resets the timer back to zero


run

public void run()
Performs timer specific code

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

timeout

public void timeout()