站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

TimerQueue (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util
Class TimerQueue

java.lang.Object
  extended byorg.jboss.util.WorkerQueue
      extended byorg.jboss.util.TimerQueue

public class TimerQueue
extends WorkerQueue

This class runs in a single thread TimerTasks 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: 1.2 $
Author:
Simone Bordet
See Also:
TimerTask

Nested Class Summary
protected  class TimerQueue.TimerTaskLoop
          Class that loops getting the next job to be executed and then executing it, in the timer task thread.
 
Nested classes inherited from class org.jboss.util.WorkerQueue
WorkerQueue.QueueLoop
 
Field Summary
 
Fields inherited from class org.jboss.util.WorkerQueue
m_queueThread
 
Constructor Summary
TimerQueue()
          Creates a new timer queue with default thread name of "TimerTask Thread"
TimerQueue(String threadName)
          Creates a new timer queue with the specified thread name
 
Method Summary
protected  void clear()
          Clears the running thread after the queue has been stopped.
protected  Runnable createQueueLoop()
          Creates the loop that will get the next job and process it.
protected  Executable getJobImpl()
          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  void putJobImpl(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.
 void schedule(TimerTask t)
          Schedules the given TimerTask for immediate execution.
 void schedule(TimerTask t, long delay)
          Schedule the given TimerTask to be executed after delay milliseconds.
 
Methods inherited from class org.jboss.util.WorkerQueue
getJob, isInterrupted, putJob, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerQueue

public TimerQueue()
Creates a new timer queue with default thread name of "TimerTask Thread"


TimerQueue

public TimerQueue(String threadName)
Creates a new timer queue with the specified thread name

Method Detail

schedule

public void schedule(TimerTask t)
Schedules the given TimerTask for immediate execution.


schedule

public void schedule(TimerTask t,
                     long delay)
Schedule the given TimerTask to be executed after delay milliseconds.


putJobImpl

protected void putJobImpl(Executable task)
Description copied from class: WorkerQueue
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.

Overrides:
putJobImpl in class WorkerQueue

getJobImpl

protected Executable getJobImpl()
                         throws InterruptedException
Description copied from class: WorkerQueue
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.

Overrides:
getJobImpl in class WorkerQueue
Throws:
InterruptedException

createQueueLoop

protected Runnable createQueueLoop()
Description copied from class: WorkerQueue
Creates the loop that will get the next job and process it.
Override in subclasses to create a custom loop.

Overrides:
createQueueLoop in class WorkerQueue

clear

protected void clear()
Description copied from class: WorkerQueue
Clears the running thread after the queue has been stopped.
After this call, this worker queue is unusable and can be garbaged.

Overrides:
clear in class WorkerQueue


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.