JBoss API: Class TimerTask

org.jboss.util
Class TimerTask

java.lang.Object
  |
  +--org.jboss.util.TimerTask
All Implemented Interfaces:
java.lang.Comparable, Executable

public abstract class TimerTask
extends java.lang.Object
implements Executable, java.lang.Comparable

A class that represent a task that can be scheduled for one-shot or repeated execution by a TimerQueue.

A similar class is present in java.util package of jdk version >= 1.3; for compatibility with jdk 1.2 we reimplemented it.

Version:
$Revision: 1.2 $
Author:
Simone Bordet (simone.bordet@compaq.com)
See Also:
TimerQueue

Constructor Summary
protected TimerTask()
          Creates a TimerTask object that will be executed once.
protected TimerTask(long period)
          Creates a TimerTask object that will be executed every period milliseconds.
 
Method Summary
 boolean cancel()
          Cancels the next execution of this TimerTask (if any).
 int compareTo(java.lang.Object other)
          A TimerTask is less than another if it will be scheduled before.
abstract  void execute()
          The task to be executed, to be implemented in subclasses.
protected  long getPeriod()
          Returns the period of this TimerTask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerTask

protected TimerTask()
Creates a TimerTask object that will be executed once.

TimerTask

protected TimerTask(long period)
Creates a TimerTask object that will be executed every period milliseconds.

Parameters:
period - the execution period; if zero, will be executed only once.
Method Detail

cancel

public boolean cancel()
Cancels the next execution of this TimerTask (if any).
If the TimerTask is executing it will prevent the next execution (if any).

execute

public abstract void execute()
                      throws java.lang.Exception
The task to be executed, to be implemented in subclasses.
Specified by:
execute in interface Executable

compareTo

public int compareTo(java.lang.Object other)
A TimerTask is less than another if it will be scheduled before.
Specified by:
compareTo in interface java.lang.Comparable

getPeriod

protected long getPeriod()
Returns the period of this TimerTask


Copyright © 2000 The JBoss Organization. All Rights Reserved.