Schedules the given task for a once-only execution at the specified time.
public voidschedule(TimerTask task, long delay)
Schedules the given task for a once-only execution after the specified
delay (in milliseconds),
public voidschedule(TimerTask task, Date firstTime, long
period)
Schedules the given task to execute on a fixed-delay schedule until
cancelled, starting at firstTime, executing every period milliseconds.
public voidschedule(TimerTask task, long delay, long period)
Schedules the given task to execute on a fixed-delay schedule until
cancelled, starting after the given delay, executing every period
milliseconds.
public voidscheduleAtFixedRate(TimerTask task, Date firstTime,
long period)
Schedules the given task to execute on a fixed-rate schedule until cancelled,
starting at firstTime, executing every period milliseconds.
public voidscheduleAtFixedRate(TimerTask task, long delay,
long period)
Schedules the given task to execute on a fixed-rate schedule until cancelled,
starting after the given delay, executing every period milliseconds.
Any time you specify that is in the past schedules an immediate execution. All times are in millisecondsthe
Date class's getTime method converts a Date to milliseconds (see "Time, Dates, and Calendars" on page
695)and are approximate because the timer uses THRead.wait(long) to schedule future executions, and
wait, like sleep, does not guarantee precision. If a delay is so large that adding it to the current time would
cause an overflow, you will get an IllegalArgumentException.
A TimerTask object can only be scheduled with one Timer, and a cancelled Timer cannot have any new
tasks scheduled. If you attempt to schedule a task that violates either of these restrictions or if you schedule an
already cancelled TimerTask, you will get an IllegalStateException.
A Timer's thread is subject to the usual thread scheduling of a system and takes no steps to influence its
priority in any wayit is created with the priority of the thread that created the Timer. If you need to boost the
priority of a given task when it is executing, set the thread priority within the run method. If you want to
boost the priority of the Timer tHRead itself, you must create the Timer from a thread that already has the
desired priority level.
There is no way to ask which tasks are being governed by a particular Timer.
22.8. UUID
The UUID class provides immutable objects that represent universally unique identifiers. These are 128-bit
values that are generated in such a way that they are guaranteed to be unique. There are four different versions