Name
java.util.Timer
Synopsis
This class defines a facility for threads to schedule tasks for
future execution in a background thread. There are four versions of
the schedule()
method; each schedules tasks to
execute at a specific time using a Date
object or
after a specific delay in milliseconds. The
scheduleAtFixedrate()
method can be used to
schedule tasks for repeated execution in intervals relative to the
scheduled execution time of the first execution. If an execution is
delayed for any reason (such as garbage collection or other
background activity), two or more subsequent executions are scheduled
at shorter intervals to catch up.
public classTimer
{ // public constructors publicTimer
(); // public instance methods public voidcancel
(); public voidschedule
(TimerTask task, Date time); public voidschedule
(TimerTask task, long delay); public voidschedule
(TimerTask task, Date firstTime, long period); public voidschedule
(TimerTask task, long delay, long period); public voidscheduleAtFixedRate
(TimerTask task, Date firstTime, long period); public voidscheduleAtFixedRate
(TimerTask task, long delay, long period); }
Get Wireless Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.