Package com.sun.javatest.util
Class Timer
- java.lang.Object
-
- com.sun.javatest.util.Timer
-
public class Timer extends java.lang.ObjectTimer objects accept requests to call back on Timeable objects after a specifiable delay.- See Also:
Timer.Timeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimer.EntryEntry objects are returned as the result calling requestDelayedCallback on a timer; they may be used to cancel the request.static interfaceTimer.TimeableImplementations of this interface are passed to Timer, to be called back after a specified interval.
-
Constructor Summary
Constructors Constructor Description Timer()Create and start a timer object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel(Timer.Entry e)Cancel a prior request to requestDelayedEntry().voidfinished()Stop accepting requests.Timer.EntryrequestDelayedCallback(Timer.Timeable obj, long delay)Request that the Timeable object given will have its timeout() method called after not less than delay milliseconds.
-
-
-
Method Detail
-
requestDelayedCallback
public Timer.Entry requestDelayedCallback(Timer.Timeable obj, long delay)
Request that the Timeable object given will have its timeout() method called after not less than delay milliseconds.- Parameters:
obj- The object to be called backdelay- The number of milliseconds to delay before invoking the timemout method on the callback object.- Returns:
- An object which can be passed to cancel() to cancel this request
-
cancel
public void cancel(Timer.Entry e)
Cancel a prior request to requestDelayedEntry().- Parameters:
e- The result of the prior call to requestDelayedEntry
-
finished
public void finished()
Stop accepting requests.
-
-