Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.util
Class TimerTask

    java.lang.Object
      org.jboss.util.TimerTask

All Implemented Interfaces:
  Comparable, Executable

public abstract class TimerTask
extends Object
implements Executable, 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
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(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 Exception

  The task to be executed, to be implemented in subclasses.

  Specified by:
    `execute` in interface `Executable`
  Throws:
    `Exception`

### compareTo

    public int compareTo(Object other)

  A TimerTask is less than another if it will be scheduled before.

  Specified by:
    `compareTo` in interface `Comparable`
  Throws:
    `ClassCastException` - if other is not a TimerTask, according to the Comparable contract

### getPeriod

    protected long getPeriod()

  Returns the period of this TimerTask

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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