|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.util.Task
public abstract class Task
A method call that is executed in a separate thread. If the method throws an exception, it is wrapped in a RuntimeException.
Field Summary | |
---|---|
protected java.lang.Object |
result
The result, if any. |
protected boolean |
stop
A flag indicating the get() method has been called. |
Constructor Summary | |
---|---|
Task()
|
Method Summary | |
---|---|
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 |
run()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile boolean stop
protected java.lang.Object result
Constructor Detail |
---|
public Task()
Method Detail |
---|
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 thread
public java.lang.Object get()
java.lang.RuntimeException
- if an exception in the method call occurspublic boolean isFinished()
public java.lang.Exception getException()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |