Task

A method call that is executed in a separate thread. If the method throws an exception, it is wrapped in a RuntimeException.

Methods
void call()
The method to be implemented.
void call() throws Exception
The method to be implemented.
Throws:
Exception - any exception is wrapped in a RuntimeException
Task execute()
Start the thread.
Task execute()
Start the thread.
Returns:
this
Task execute(String threadName)
Start the thread.
Task execute(String threadName)
Start the thread.
Parameters:
threadName - the name of the thread
Returns:
this
Object get()
Calling this method will set the stop flag and wait until the thread is stopped.
Object get()
Calling this method will set the stop flag and wait until the thread is stopped.
Returns:
the result, or null
Throws:
RuntimeException - if an exception in the method call occurs
Exception getException()
Get the exception that was thrown in the call (if any).
Exception getException()
Get the exception that was thrown in the call (if any).
Returns:
the exception or null
boolean isFinished()
Whether the call method has returned (with or without exception).
boolean isFinished()
Whether the call method has returned (with or without exception).
Returns:
true if yes
void join()
Stop the thread and wait until it is no longer running.
void join()
Stop the thread and wait until it is no longer running. Exceptions are ignored.
void run()
void run()