Package org.jboss.util
Class TimerQueue
- java.lang.Object
-
- org.jboss.util.WorkerQueue
-
- org.jboss.util.TimerQueue
-
public class TimerQueue extends WorkerQueue
This class runs in a single threadTimerTasks that have been scheduled.A similar class is present in java.util package of jdk version >= 1.3; for compatibility with jdk 1.2 it is reimplemented here.
- Version:
- $Revision$
- See Also:
TimerTask
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTimerQueue.TimerTaskLoopClass that loops getting the next job to be executed and then executing it, in the timer task thread.-
Nested classes/interfaces inherited from class org.jboss.util.WorkerQueue
WorkerQueue.QueueLoop
-
-
Field Summary
Fields Modifier and Type Field Description private Heapm_heap-
Fields inherited from class org.jboss.util.WorkerQueue
m_queueThread
-
-
Constructor Summary
Constructors Constructor Description TimerQueue()Creates a new timer queue with default thread name of "TimerTask Thread"TimerQueue(java.lang.String threadName)Creates a new timer queue with the specified thread name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclear()Clears the running thread after the queue has been stopped.protected java.lang.RunnablecreateQueueLoop()Creates the loop that will get the next job and process it.protected ExecutablegetJobImpl()Never call this method, only override in subclasses to perform job getting in a specific way, normally tied to the data structure holding the jobs.protected voidputJobImpl(Executable task)Never call this method, only override in subclasses to perform job adding in a specific way, normally tied to the data structure holding the jobs.voidschedule(TimerTask t)Schedules the given TimerTask for immediate execution.voidschedule(TimerTask t, long delay)Schedule the given TimerTask to be executed afterdelaymilliseconds.-
Methods inherited from class org.jboss.util.WorkerQueue
getJob, isInterrupted, putJob, start, stop
-
-
-
-
Field Detail
-
m_heap
private Heap m_heap
-
-
Method Detail
-
schedule
public void schedule(TimerTask t)
Schedules the given TimerTask for immediate execution.- Parameters:
t-
-
schedule
public void schedule(TimerTask t, long delay)
Schedule the given TimerTask to be executed afterdelaymilliseconds.- Parameters:
t-delay-
-
putJobImpl
protected void putJobImpl(Executable task)
Description copied from class:WorkerQueueNever call this method, only override in subclasses to perform job adding in a specific way, normally tied to the data structure holding the jobs.- Overrides:
putJobImplin classWorkerQueue
-
getJobImpl
protected Executable getJobImpl() throws java.lang.InterruptedException
Description copied from class:WorkerQueueNever call this method, only override in subclasses to perform job getting in a specific way, normally tied to the data structure holding the jobs.- Overrides:
getJobImplin classWorkerQueue- Returns:
- the exectuable
- Throws:
java.lang.InterruptedException
-
createQueueLoop
protected java.lang.Runnable createQueueLoop()
Description copied from class:WorkerQueueCreates the loop that will get the next job and process it.
Override in subclasses to create a custom loop.- Overrides:
createQueueLoopin classWorkerQueue- Returns:
- the runnable
-
clear
protected void clear()
Description copied from class:WorkerQueueClears the running thread after the queue has been stopped.
After this call, this worker queue is unusable and can be garbaged.- Overrides:
clearin classWorkerQueue
-
-