|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectTask.SimpleTaskHandler<ReturnValueType>
public class SimpleTaskHandler<ReturnValueType>
TaskHandler is a convenience class that you can extend in order to override only the methods that you want to override for your task handler.
more information on the TaskHandlerIF| Constructor Summary | |
|---|---|
SimpleTaskHandler()
|
|
| 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleTaskHandler()
| Method Detail |
|---|
public void beforeStart(AbstractTask task)
beforeStart in interface SimpleTaskHandlerIF<ReturnValueType>task - public void started(AbstractTask task)
started in interface SimpleTaskHandlerIF<ReturnValueType>task -
public void stopped(long time,
AbstractTask task)
stopped in interface SimpleTaskHandlerIF<ReturnValueType>
public void interrupted(java.lang.Throwable e,
AbstractTask task)
interrupted in interface SimpleTaskHandlerIF<ReturnValueType>e - this holds the underlying exception that holds more information on the
public void ok(ReturnValueType value,
long time,
AbstractTask task)
ok in interface SimpleTaskHandlerIF<ReturnValueType>value - this is optional. the task may want to pass an object or objects to the task
public void error(java.lang.Throwable e,
long time,
AbstractTask task)
error in interface SimpleTaskHandlerIF<ReturnValueType>e - this is used to pass the exception that caused the task to stop to be reported to the
public void cancelled(long time,
AbstractTask task)
SimpleTaskHandlerIF.stopped(long, AbstractTask), SimpleTaskHandlerIF.error(Throwable,long, AbstractTask),
SimpleTaskHandlerIF.ok(ReturnValueType, long, Task.AbstractTask), and SimpleTaskHandlerIF.interrupted(Throwable, AbstractTask).
In your handler implementation, just throw the results away, and assume everything has stopped
and terminated.
this runs in the EDT.
cancelled in interface SimpleTaskHandlerIF<ReturnValueType>public void shutdownCalled(AbstractTask task)
AbstractTask.shutdown() is called. It signifies
that the task is going to stop.
shutdownCalled in interface SimpleTaskHandlerIF<ReturnValueType>task -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||