Package org.eclipse.ease
Class ScriptResult
java.lang.Object
org.eclipse.ease.ScriptResult
public class ScriptResult extends Object implements Future<Object>
A ScriptResult is a container for a script execution. As execution often occurs detached from the System thread, the result object contains an indicator for
pending and finished results. Results itself may contain an object or an exception.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ScriptResult()
-
Method Summary
Modifier and Type Method Description boolean
cancel(boolean mayInterruptIfRunning)
Object
get()
Object
get(long milliSeconds)
Object
get(long timeout, TimeUnit unit)
Throwable
getException()
Deprecated.Object
getResult()
Deprecated.useget()
boolean
hasException()
Deprecated.useget()
boolean
isCancelled()
boolean
isDone()
boolean
isReady()
Deprecated.useisDone()
void
setException(ScriptExecutionException e)
Set an exception to be stored for this result.void
setResult(Object result)
Set the result to be stored.String
toString()
void
waitForResult()
Deprecated.useget()
void
waitForResult(long milliseconds)
Deprecated.
-
Field Details
-
VOID
Special void object for script methods not returning a result.
-
-
Constructor Details
-
ScriptResult
public ScriptResult()
-
-
Method Details
-
setResult
Set the result to be stored.- Parameters:
result
- object to be stored
-
setException
Set an exception to be stored for this result.- Parameters:
e
- exception to be stored
-
toString
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceFuture<Object>
-
isDone
public boolean isDone() -
get
- Specified by:
get
in interfaceFuture<Object>
- Throws:
ExecutionException
-
get
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException- Specified by:
get
in interfaceFuture<Object>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
get
public Object get(long milliSeconds) throws InterruptedException, ExecutionException, TimeoutException -
waitForResult
Deprecated.useget()
Blocks execution until the execution result is ready.- Throws:
ExecutionException
-
waitForResult
@Deprecated public void waitForResult(long milliseconds) throws InterruptedException, TimeoutExceptionDeprecated.Blocks execution until the execution result is ready or the timeout is reached. Once this method returns you still need to queryisReady()
as the timeout might have depleted.- Parameters:
milliseconds
- the maximum time to wait in milliseconds.- Throws:
InterruptedException
TimeoutException
-
isReady
Deprecated.useisDone()
Verify that this ScriptResult is processed. If the result is ready, execution of the underlying script is done.- Returns:
- true when processing is done
-
getResult
Deprecated.useget()
Get the result value stored.- Returns:
- result value
-
getException
Deprecated.useget()
Get the exception stored within this result.- Returns:
- stored exception or null
-
hasException
Deprecated.useget()
Checks whether this result contains an exception.- Returns:
- true when this result contains an exception
-
get()