org.exolab.jms.scheduler
Class SerialTask
java.lang.Object
|
+--org.exolab.jms.scheduler.SerialTask
- All Implemented Interfaces:
- java.lang.Runnable
- public class SerialTask
- extends java.lang.Object
- implements java.lang.Runnable
A Runnable
implementation which may only be executed serially by the
Scheduler
.
- Version:
- $Revision: 1.1 $ $Date: 2005/08/30 05:38:56 $
- Author:
- Tim Anderson
Constructor Summary |
SerialTask(java.lang.Runnable task,
Scheduler scheduler)
Construct a new SerialTask . |
Method Summary |
void |
run()
Run the task. |
boolean |
schedule()
Schedule this to run. |
void |
stop()
Stop the task. |
java.lang.String |
toString()
Returns a stringified form of this, for debugging purposes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SerialTask
public SerialTask(java.lang.Runnable task,
Scheduler scheduler)
- Construct a new
SerialTask
.
- Parameters:
task
- the task to executescheduler
- the scheduler
schedule
public boolean schedule()
throws java.lang.InterruptedException
- Schedule this to run.
If the task is currently running, it will be scheduled after it has
completed.
- Returns:
true
if the task was scheduled; false
if the task is already scheduled, or is in the process of
stopping- Throws:
java.lang.InterruptedException
- if the task can't be scheduled
run
public void run()
- Run the task.
- Specified by:
run
in interface java.lang.Runnable
stop
public void stop()
- Stop the task.
This will wait for the task to complete before returning. If the task
has been scheduled to run again, it will be cancelled.
toString
public java.lang.String toString()
- Returns a stringified form of this, for debugging purposes.
- Overrides:
toString
in class java.lang.Object
- Returns:
- a stringified form of this
Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.