public abstract class Task
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
boolean |
stop
A flag indicating the get() method has been called.
|
Constructor and Description |
---|
Task() |
Modifier and Type | Method and Description |
---|---|
abstract void |
call()
The method to be implemented.
|
Task |
execute()
Start the thread.
|
Task |
execute(java.lang.String threadName)
Start the thread.
|
java.lang.Object |
get()
Calling this method will set the stop flag and wait until the thread is
stopped.
|
java.lang.Exception |
getException()
Get the exception that was thrown in the call (if any).
|
boolean |
isFinished()
Whether the call method has returned (with or without exception).
|
void |
join()
Stop the thread and wait until it is no longer running.
|
void |
run() |
public abstract void call() throws java.lang.Exception
java.lang.Exception
- any exception is wrapped in a RuntimeExceptionpublic void run()
run
in interface java.lang.Runnable
public Task execute()
public Task execute(java.lang.String threadName)
threadName
- the name of the threadpublic java.lang.Object get()
java.lang.RuntimeException
- if an exception in the method call occurspublic boolean isFinished()
public java.lang.Exception getException()
public void join()