|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfoxtrot.Task
public abstract class Task
A time-consuming task to be executed in the Worker Thread that may throw checked exceptions.
Users must implement the run() method with the time-consuming code, and not worry about
exceptions, for example:
Task task = new Task()
{
public Object run() throws InterruptedException
{
Thread.sleep(10000);
return null;
}
};
Exceptions and Errors thrown by the run() method will be rethrown automatically by
Worker.post(Task) or by ConcurrentWorker.post(Task)
Worker,
ConcurrentWorker| Constructor Summary | |
|---|---|
protected |
Task()
Creates a new Task. |
| Method Summary | |
|---|---|
protected Object |
getResultOrThrow()
Returns the result of this Task operation, as set by setResult(java.lang.Object). |
boolean |
isCompleted()
Returns whether the execution of this Task has been completed or not. |
abstract Object |
run()
The method to implement with time-consuming code. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Task()
| Method Detail |
|---|
public abstract Object run()
throws Exception
Exception
protected final Object getResultOrThrow()
throws Exception
setResult(java.lang.Object).
If an exception or an error is thrown by run(), it is rethrown here.
Synchronized since the variables are accessed from 2 threads
Accessed from the AWT Event Dispatch Thread.
ExceptionsetResult(java.lang.Object),
setThrowable(java.lang.Throwable)public final boolean isCompleted()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||