public class Timer
extends java.lang.Object
Timer.Timeable
Modifier and Type | Class and Description |
---|---|
class |
Timer.Entry
Entry objects are returned as the result calling
requestDelayedCallback on a timer; they may be used to cancel the request.
|
static interface |
Timer.Timeable
Implementations of this interface are passed to Timer, to be
called back after a specified interval.
|
Constructor and Description |
---|
Timer()
Create and start a timer object.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel(Timer.Entry e)
Cancel a prior request to requestDelayedEntry().
|
void |
finished()
Stop accepting requests.
|
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.
|
public Timer.Entry requestDelayedCallback(Timer.Timeable obj, long delay)
obj
- The object to be called backdelay
- The number of milliseconds to delay before invoking the
timemout method on the callback object.public void cancel(Timer.Entry e)
e
- The result of the prior call to requestDelayedEntrypublic void finished()
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.