ExecuteResultHandler
public class DefaultExecuteResultHandler extends java.lang.Object implements ExecuteResultHandler
Constructor | Description |
---|---|
DefaultExecuteResultHandler() |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
ExecuteException |
getException() |
Get the
exception causing the process execution to fail. |
int |
getExitValue() |
Get the
exitValue of the process. |
boolean |
hasResult() |
Has the process exited and a result is available, i.e.
|
void |
onProcessComplete(int exitValue) |
The asynchronous execution completed.
|
void |
onProcessFailed(ExecuteException e) |
The asynchronous execution failed.
|
void |
waitFor() |
Causes the current thread to wait, if necessary, until the
process has terminated.
|
void |
waitFor(long timeout) |
Causes the current thread to wait, if necessary, until the
process has terminated.
|
public DefaultExecuteResultHandler()
public void onProcessComplete(int exitValue)
ExecuteResultHandler
onProcessComplete
in interface ExecuteResultHandler
exitValue
- the exit value of the sub-processExecuteResultHandler.onProcessComplete(int)
public void onProcessFailed(ExecuteException e)
ExecuteResultHandler
onProcessFailed
in interface ExecuteResultHandler
e
- the ExecuteException
containing the root causeExecuteResultHandler.onProcessFailed(org.apache.commons.exec.ExecuteException)
public ExecuteException getException()
exception
causing the process execution to fail.java.lang.IllegalStateException
- if the process has not exited yetpublic int getExitValue()
exitValue
of the process.java.lang.IllegalStateException
- if the process has not exited yetpublic boolean hasResult()
public void waitFor() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the current thread is
interrupted by another
thread while it is waiting, then the wait is ended and
an InterruptedException
is thrown.public void waitFor(long timeout) throws java.lang.InterruptedException
timeout
- the maximum time to wait in millisecondsjava.lang.InterruptedException
- if the current thread is
interrupted by another
thread while it is waiting, then the wait is ended and
an InterruptedException
is thrown.