|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface SimpleTaskHandlerIF<ReturnValueType>
TaskHandlerIF is an interface that encapsulates the various lifecyle stages that a task will go through. This allows task writers to add event handling code as a task progresses through various stages.
Here's a quick rundown of the various paths that can be taken:
| Method Summary | |
|---|---|
void |
beforeStart(AbstractTask task)
this method is called before the background thread is started. good place to do prep work if any needs to be done. |
void |
cancelled(long time,
AbstractTask task)
This is called after started(). it signifies that the task was cancelled by cancel() being called on it's SwingWorker thread. |
void |
error(java.lang.Throwable e,
long time,
AbstractTask task)
this is called after stopped(). it signifies failure of task execution. |
void |
interrupted(java.lang.Throwable e,
AbstractTask task)
this is called after the task has been interrupted. ok or error may not be called after this. |
void |
ok(ReturnValueType value,
long time,
AbstractTask task)
this is called after stopped(). it signifies successful task completion. |
void |
shutdownCalled(AbstractTask task)
This method is called on the task handler when AbstractTask.shutdown() is called. |
void |
started(AbstractTask task)
this is called after the task is started, it's not running in the background at this point, but is just about to. all the states have been setup (in the task) and updates sent out. |
void |
stopped(long time,
AbstractTask task)
this is called after the task has ended normally (not interrupted). ok or error may be called after this. |
| Method Detail |
|---|
void beforeStart(AbstractTask task)
void started(AbstractTask task)
void stopped(long time,
AbstractTask task)
void interrupted(java.lang.Throwable e,
AbstractTask task)
e - this holds the underlying exception that holds more information on the
void ok(ReturnValueType value,
long time,
AbstractTask task)
value - this is optional. the task may want to pass an object or objects to the task
void error(java.lang.Throwable e,
long time,
AbstractTask task)
e - this is used to pass the exception that caused the task to stop to be reported to the
void cancelled(long time,
AbstractTask task)
stopped(long, AbstractTask), error(Throwable,long, AbstractTask),
ok(ReturnValueType, long, Task.AbstractTask), and interrupted(Throwable, AbstractTask).
In your handler implementation, just throw the results away, and assume everything has stopped
and terminated.
this runs in the EDT.
void shutdownCalled(AbstractTask task)
AbstractTask.shutdown() is called. It signifies
that the task is going to stop.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||