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 booleancancel(boolean mayInterruptIfRunning)Objectget()Objectget(long milliSeconds)Objectget(long timeout, TimeUnit unit)ThrowablegetException()Deprecated.ObjectgetResult()Deprecated.useget()booleanhasException()Deprecated.useget()booleanisCancelled()booleanisDone()booleanisReady()Deprecated.useisDone()voidsetException(ScriptExecutionException e)Set an exception to be stored for this result.voidsetResult(Object result)Set the result to be stored.StringtoString()voidwaitForResult()Deprecated.useget()voidwaitForResult(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:
isCancelledin interfaceFuture<Object>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<Object>- Throws:
ExecutionException
-
get
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException- Specified by:
getin interfaceFuture<Object>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
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:
InterruptedExceptionTimeoutException
-
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()