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(String threadName)
Start the thread.
|
Object |
get()
Calling this method will set the stop flag and wait until the thread is
stopped.
|
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 Exception
Exception
- any exception is wrapped in a RuntimeExceptionpublic Task execute()
public Task execute(String threadName)
threadName
- the name of the threadpublic Object get()
RuntimeException
- if an exception in the method call occurspublic boolean isFinished()
public Exception getException()
public void join()
Copyright © 2020 JBoss by Red Hat. All rights reserved.