public class CommandReturn
extends java.lang.Object
Commander.startProcess(org.jlab.coda.cMsg.remoteExec.ExecutorInfo, java.lang.String, boolean, org.jlab.coda.cMsg.remoteExec.CommandCallback, java.lang.Object) or Commander.startThread(org.jlab.coda.cMsg.remoteExec.ExecutorInfo, java.lang.String, org.jlab.coda.cMsg.remoteExec.CommandCallback, java.lang.Object, org.jlab.coda.cMsg.remoteExec.ConstructorInfo)
methods and is used to track the process of command given
to an Executor.| Constructor and Description |
|---|
CommandReturn(Commander commander,
ExecutorInfo executor,
CallbackState callbackState)
Constructor.
|
CommandReturn(Commander commander,
ExecutorInfo executor,
int id,
int processId,
boolean error,
boolean terminated,
java.lang.String regularOutput,
java.lang.String errorOutput)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
callbackCancelled()
Has the callback been cancelled for any reason?
|
void |
executeCallback()
Run the registered callback.
|
CallbackState |
getCallbackState()
Get the state of the callback.
|
java.lang.String |
getError()
Get error output (if any) generated by the started process or thread.
|
(package private) int |
getExecutorId()
Get the Executor generated id number.
|
int |
getId()
Get the Commander generated id number.
|
java.lang.String |
getOutput()
Get output (if any) generated by the started process or thread.
|
boolean |
hasError()
Get whether error occurred in the attempt to run the process or thread.
|
boolean |
hasOutput()
Get whether the process has any output.
|
boolean |
hasTerminated()
Get whether the process has already terminated.
|
(package private) void |
hasTerminated(boolean b)
Set whether the process has already terminated.
|
boolean |
isLocked()
Is this object locked from further updates?
|
(package private) void |
lock()
Lock this object from further updates.
|
void |
registerCallback(CommandCallback processCallback,
java.lang.Object userObject)
Register a callback to be run when the process ends.
|
(package private) void |
setCallbackState(CallbackState callbackState)
Set the state of the callback, but not when locked.
|
(package private) void |
setCallbackStateIfLocked(CallbackState callbackState)
Set the state of the callback even if locked.
|
(package private) void |
setError(java.lang.String error)
Set error output generated by the started process or thread.
|
(package private) void |
setOutput(java.lang.String output)
Set output generated by the started process or thread.
|
void |
setValues(int id,
int processId,
boolean error,
boolean terminated,
java.lang.String regularOutput,
java.lang.String errorOutput)
Set various member values, but not when locked.
|
void |
stop()
Stop the process or thread on the executor this object is associated with.
|
java.lang.String |
toString() |
void |
unregisterCallback()
Unregister a callback so it does not get run.
|
CommandReturn(Commander commander, ExecutorInfo executor, CallbackState callbackState)
commander - Commander object which is calling this method.executor - ExecutorInfo object the Commander is talking to.callbackState - state of the callbackCommandReturn(Commander commander, ExecutorInfo executor, int id, int processId, boolean error, boolean terminated, java.lang.String regularOutput, java.lang.String errorOutput)
commander - Commander object which is calling this method.executor - ExecutorInfo object the Commander is talking to.id - id number generated by Commander.processId - associated id number generated by Executor.error - was there an error running the process/thread?terminated - has process terminated already?regularOutput - regular output (if any) of the started processerrorOutput - error output (if any) of the started processpublic void setValues(int id,
int processId,
boolean error,
boolean terminated,
java.lang.String regularOutput,
java.lang.String errorOutput)
id - id number generated by Commander.processId - associated id number generated by Executor.error - was there an error running the process/thread?terminated - has process terminated already?regularOutput - regular output (if any) of the started processerrorOutput - error output (if any) of the started processpublic void stop()
public boolean isLocked()
true if locked, else falsevoid lock()
public void registerCallback(CommandCallback processCallback, java.lang.Object userObject)
processCallback - callback to be run when the process ends.userObject - argument to be passed to callback.public void unregisterCallback()
public void executeCallback()
public boolean callbackCancelled()
true if callback has already been cancelled, else false.public CallbackState getCallbackState()
void setCallbackState(CallbackState callbackState)
callbackState - state of the callback.void setCallbackStateIfLocked(CallbackState callbackState)
callbackState - state of the callback.int getExecutorId()
public int getId()
void hasTerminated(boolean b)
b - true if process has terminated, else false.public boolean hasTerminated()
true if process has already terminated, else false.public boolean hasError()
true if error occurred attempting to run process/thread,
else false.public boolean hasOutput()
true if the process has output, else false.public java.lang.String getOutput()
public java.lang.String getError()
void setError(java.lang.String error)
error - error output by the process or thread.void setOutput(java.lang.String output)
output - output by the process or thread.public java.lang.String toString()
toString in class java.lang.Object