public final class VTNTimer extends Timer
VTNTimer
describes a thread to schedule timer tasks.Constructor and Description |
---|
VTNTimer(String name)
Construct a new timer thread associated with the given name.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel all tasks previously scheduled, and terminate this timer thread.
|
boolean |
checkedSchedule(TimerTask task,
long delay)
Schedule the given task to be executed after the given delay.
|
boolean |
flush(long timeout,
TimeUnit unit)
Flush the task queue for this timer.
|
boolean |
isAvailable()
Determine whether this timer is available or not.
|
void |
schedule(TimerTask task,
Date time)
Schedule the given task to be executed at the given time.
|
void |
schedule(TimerTask task,
Date firstTime,
long period)
Schedule the given task to be executed periodically.
|
void |
schedule(TimerTask task,
long delay)
Schedule the given task to be executed after the given delay.
|
void |
schedule(TimerTask task,
long delay,
long period)
Schedule the given task to be executed periodically.
|
void |
scheduleAtFixedRate(TimerTask task,
Date firstTime,
long period)
Schedule the given task to be executed periodically at the fixed rate.
|
void |
scheduleAtFixedRate(TimerTask task,
long delay,
long period)
Schedule the given task to be executed periodically at the fixed rate.
|
boolean |
shutdown()
Shut down the timer.
|
public VTNTimer(String name)
name
- THe name of the timer thread.public boolean shutdown()
Tasks previously scheduled are not canceled, but no more timer task will be scheduled.
true
if the timer shutdown has been initiated.
false
if the timer is already down.public boolean isAvailable()
true
only if this timer is available.public boolean flush(long timeout, TimeUnit unit) throws VTNException
This method can be used even if the timer shut down is already
initiated by shutdown()
.
timeout
- The timeout to wait for all tasks to complete.unit
- The time unit for timeout
argument.true
if all tasks previously scheduled completed.
false
if this timer is already canceled.VTNException
- An error occurred.public boolean checkedSchedule(TimerTask task, long delay)
task
- A task to be executed.delay
- The number of milliseconds in delay before execution.true
on success.
false
if this timer is unavailable.public void schedule(TimerTask task, long delay)
public void schedule(TimerTask task, Date time)
public void schedule(TimerTask task, long delay, long period)
public void schedule(TimerTask task, Date firstTime, long period)
public void scheduleAtFixedRate(TimerTask task, long delay, long period)
scheduleAtFixedRate
in class Timer
task
- A task to be executed.delay
- The number of milliseconds to be inserted before the
first execution.period
- The number of milliseconds between successive task
executions.public void scheduleAtFixedRate(TimerTask task, Date firstTime, long period)
scheduleAtFixedRate
in class Timer
task
- A task to be executed.firstTime
- The time of the first execution.period
- The number of milliseconds between successive task
executions.Copyright © 2018 OpenDaylight. All rights reserved.