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

SchedulableRunnable (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


org.jboss.mx.util
Class SchedulableRunnable

java.lang.Object
  extended byorg.jboss.mx.util.SchedulableRunnable
All Implemented Interfaces:
Comparable, Runnable
Direct Known Subclasses:
MonitorRunnable

public abstract class SchedulableRunnable
extends Object
implements Comparable, Runnable

A schedulable runnable.

Subclasses should implement doRun() to do some real work.

setScheduler(RunnableScheduler) has to be invoked with a RunnableScheduler that has been started for the work to be performed. If the doRun() does not invoke setNextRun(), the link to the scheduler is removed.

Version:
$Revision: 1.3 $
Author:
Adrian Brock.
See Also:
RunnableScheduler

Constructor Summary
SchedulableRunnable()
          Constructs a new schedulable runnable.
 
Method Summary
 int compareTo(Object o)
           
abstract  void doRun()
          Do the work, the scheduled runnable should do its work here
 boolean equals(Object obj)
           
 long getNextRun()
          Gets the next run timestamp
 void run()
          Runs doRun()
 void setNextRun(long nextRun)
          Sets the next run date
 RunnableScheduler setScheduler(RunnableScheduler scheduler)
          Set the scheduler for this runnable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchedulableRunnable

public SchedulableRunnable()
Constructs a new schedulable runnable.

Method Detail

getNextRun

public long getNextRun()
Gets the next run timestamp

Returns:
the next run

setNextRun

public void setNextRun(long nextRun)
Sets the next run date

If it is linked to a scheduler, it is temporarily removed while the date is modified.

Parameters:
nextRun - the next run date

setScheduler

public RunnableScheduler setScheduler(RunnableScheduler scheduler)
Set the scheduler for this runnable

Parameters:
scheduler - pass null to remove the runnable from any scheduler
Returns:
the previous scheduler or null if there was no previous scheduler

doRun

public abstract void doRun()
Do the work, the scheduled runnable should do its work here


run

public final void run()
Runs doRun()

If setNextRun() is not invoked during the doRun(), the link to the scheduler is removed

Specified by:
run in interface Runnable

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object obj)


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