| 限定符和类型 | 字段和说明 |
|---|---|
boolean |
stop
A flag indicating the get() method has been called.
|
| 构造器和说明 |
|---|
Task() |
| 限定符和类型 | 方法和说明 |
|---|---|
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 © 2022. All rights reserved.