|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.luc.cs.trull.EmptyComponent
edu.luc.cs.trull.TerminatingComponent
edu.luc.cs.trull.task.DefaultTaskWorker
public class DefaultTaskWorker
A Worker for the step-by-step execution of a Task using Trull's default scheduling mechanism. If this Worker does not provide sufficient responsiveness, consider making the task finer-grained or using a Worker implementation that carries out the task in one or more separate threads.
Task,
QueuedTaskWorker,
PooledTaskWorker| Field Summary | |
|---|---|
protected boolean |
firstTime
A flag indicating whether the task is being executed for the first time. |
private static org.apache.log4j.Logger |
logger
|
protected java.lang.Runnable |
repeat
A Runnable that executes one step of the task and reschedules itself for execution as long as the worker has not been suspended. |
protected static int |
RUNNING
The running state. |
protected int |
state
The variable holding the current state. |
protected static int |
STOPPED
The stopped state. |
protected static int |
SUSPENDED
The suspended state. |
protected Task |
task
The task executed by this worker. |
| Constructor Summary | |
|---|---|
DefaultTaskWorker(Task task)
Constructs a worker for the given task. |
|
| Method Summary | |
|---|---|
void |
resume()
Resumes this suspendable component. |
void |
setTask(Task task)
Sets the task to be performed. |
void |
start(java.beans.PropertyChangeEvent incoming)
Restarts the task if necessary and schedules the repeat Runnable for executing the task step-by-step. |
void |
stop()
Stops this startable component. |
void |
suspend()
Suspends this suspendable component. |
| Methods inherited from class edu.luc.cs.trull.TerminatingComponent |
|---|
fireTermination, getParent, getTermEvent, scheduleTermination, setTerminationListener |
| Methods inherited from class edu.luc.cs.trull.EmptyComponent |
|---|
addPropertyChangeListener, getPropertyChangeListeners, getTerminationListener, propertyChange, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean firstTime
private static org.apache.log4j.Logger logger
protected final java.lang.Runnable repeat
protected static final int RUNNING
protected int state
protected static final int STOPPED
protected static final int SUSPENDED
protected Task task
| Constructor Detail |
|---|
public DefaultTaskWorker(Task task)
task - the task to be performed.
java.lang.IllegalArgumentException - if the task is null.| Method Detail |
|---|
public void resume()
Suspendable
resume in interface Suspendableresume in class EmptyComponentpublic void setTask(Task task)
task - the task to be performed.
java.lang.IllegalArgumentException - if the task is null.public void start(java.beans.PropertyChangeEvent incoming)
start in interface Startablestart in class EmptyComponentincoming - the event that triggered the invocation of this method. May be null.public void stop()
Startable
stop in interface Startablestop in class EmptyComponentpublic void suspend()
Suspendable
suspend in interface Suspendablesuspend in class EmptyComponent
|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||