mx4j.timer

Class TimeQueue

public class TimeQueue extends Object

A queue that executes TimeTasks when it is started.
Every scheduled task is executed at the specified time; if this time is in the past, the task is executed immediately. Just before the task is executed, the task itself is updated so that its new execution time is set or it is marked as finished (if it is not forever periodic).

Version: $Revision: 1.5 $

See Also: TimeTask

Constructor Summary
TimeQueue()
Creates a new TimeQueue
TimeQueue(boolean daemon)
Creates a new TimeQueue that will set the thread daemon or not depending on the given argument
Method Summary
voidclear()
Removes all the tasks from this TimeQueue.
voidschedule(TimeTask task)
Schedules the given task for execution.
intsize()
Returns the number of tasks present in this TimeQueue
voidstart()
Starts this TimeQueue.
voidstop()
Stops this TimeQueue.
voidunschedule(TimeTask task)
Removes the given task from this TimeQueue

Constructor Detail

TimeQueue

public TimeQueue()
Creates a new TimeQueue

TimeQueue

public TimeQueue(boolean daemon)
Creates a new TimeQueue that will set the thread daemon or not depending on the given argument

Method Detail

clear

public void clear()
Removes all the tasks from this TimeQueue.

schedule

public void schedule(TimeTask task)
Schedules the given task for execution.

See Also: TimeQueue

size

public int size()
Returns the number of tasks present in this TimeQueue

start

public void start()
Starts this TimeQueue.
Tasks are executed only after the queue has been started.

See Also: TimeQueue

stop

public void stop()
Stops this TimeQueue.
No task is executed when the queue is stopped; however, already scheduled tasks are not removed; restarting the queue has the effect of executing the tasks remained if their time has come.

See Also: TimeQueue

unschedule

public void unschedule(TimeTask task)
Removes the given task from this TimeQueue

See Also: TimeQueue

Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.