ExecutionHandle Objects

Monitors and controls execution of a Task by a Session. A new handle is created for each execution.

e.getErrorMessage() : string

Returns an error message if execution terminated with an error and a message is available; returns None otherwise.

e.getExecutionState() : ExecutionState

Returns the latest ExecutionState of the associated task.

e.getExitCode() : int

Returns the exit code from executing the task. Typically this is either 0 to indicate success or 1 to indicate failure although some tasks may use different conventions. The result of querying the exit code before the task has finished executing is undefined.

e.getResult() : Object

Returns the result of the task if execution terminated with success and the task produced a result. Returns None if the task is still executing, or if it terminated in a state other than SUCCESS, or if it did not return a result.

e.getTask() : Task

Returns the Task being executed.

e.terminate() : ExecutionState

Terminates execution of the associated task and returns its final ExecutionState. The call blocks until the task has finished. The return value may not be TERMINATED if execution had completed before the termination request was sent.

e.terminate(milliseconds) : ExecutionState

milliseconds (long) : the maximum time to wait for the task to complete

Terminates execution of the associated task, waits until the task has finished or until the specified timeout has expired (whichever is sooner) and returns the execution state of the task. The result may not be TERMINATED if execution had completed before the termination request was sent or if execution had not completed before the timeout expired. A timeout of 0 or less means to wait forever.

e.waitForCompletion() : ExecutionState

Waits until the associated task has finished executing and returns its final ExecutionState.

e.waitForCompletion(milliseconds) : ExecutionState

milliseconds (long) : the maximum time to wait for completion

Waits until the associated task has finished executing, or until the specified timeout has expired (whichever is sooner) and returns the ExecutionState of the task. A timeout of 0 or less means to wait forever.