|
||||||||||
| 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 java.lang.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 java.lang.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 java.lang.Object run()
throws java.lang.Exception
java.lang.Exception
protected final java.lang.Object getResultOrThrow()
throws java.lang.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.
java.lang.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 | |||||||||