Package org.apache.commons.exec
Class DefaultExecuteResultHandler
java.lang.Object
org.apache.commons.exec.DefaultExecuteResultHandler
- All Implemented Interfaces:
- ExecuteResultHandler
A default implementation of 'ExecuteResultHandler' used for asynchronous process handling.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionGets theexceptioncausing the process execution to fail.intGets theexitValueof the process.booleanTests whether the process exited and a result is available, i.e. exitCode or exception?voidonProcessComplete(int exitValue) The asynchronous execution completed.voidThe asynchronous execution failed.voidwaitFor()Causes the current thread to wait, if necessary, until the process has terminated.voidwaitFor(long timeoutMillis) Deprecated.voidCauses the current thread to wait, if necessary, until the process has terminated.
- 
Constructor Details- 
DefaultExecuteResultHandlerpublic DefaultExecuteResultHandler()Constructs a new instance.
 
- 
- 
Method Details- 
getExceptionGets theexceptioncausing the process execution to fail.- Returns:
- the exception.
- Throws:
- IllegalStateException- if the process has not exited yet.
 
- 
getExitValueGets theexitValueof the process.- Returns:
- the exitValue.
- Throws:
- IllegalStateException- if the process has not exited yet.
 
- 
hasResultTests whether the process exited and a result is available, i.e. exitCode or exception?- Returns:
- true whether a result of the execution is available.
 
- 
onProcessCompleteDescription copied from interface:ExecuteResultHandlerThe asynchronous execution completed.- Specified by:
- onProcessCompletein interface- ExecuteResultHandler
- Parameters:
- exitValue- the exit value of the sub-process.
- See Also:
 
- 
onProcessFailedDescription copied from interface:ExecuteResultHandlerThe asynchronous execution failed.- Specified by:
- onProcessFailedin interface- ExecuteResultHandler
- Parameters:
- e- the- ExecuteExceptioncontaining the root cause.
- See Also:
 
- 
waitForCauses the current thread to wait, if necessary, until the process has terminated. This method returns immediately if the process has already terminated. If the process has not yet terminated, the calling thread will be blocked until the process exits.- Throws:
- InterruptedException- if the current thread is interrupted by another thread while it is waiting, then the wait is ended and an- InterruptedExceptionis thrown.
 
- 
waitForCauses the current thread to wait, if necessary, until the process has terminated. This method returns immediately if the process has already terminated. If the process has not yet terminated, the calling thread will be blocked until the process exits.- Parameters:
- timeout- the maximum time to wait.
- Throws:
- InterruptedException- if the current thread is interrupted by another thread while it is waiting, then the wait is ended and an- InterruptedExceptionis thrown.
- Since:
- 1.4.0
 
- 
waitForDeprecated.UsewaitFor(Duration).Causes the current thread to wait, if necessary, until the process has terminated. This method returns immediately if the process has already terminated. If the process has not yet terminated, the calling thread will be blocked until the process exits.- Parameters:
- timeoutMillis- the maximum time to wait in milliseconds.
- Throws:
- InterruptedException- if the current thread is interrupted by another thread while it is waiting, then the wait is ended and an- InterruptedExceptionis thrown.
 
 
- 
waitFor(Duration).