public class DefaultExecuteResultHandler extends java.lang.Object implements ExecuteResultHandler
构造器和说明 |
---|
DefaultExecuteResultHandler()
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
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. exitCode or exception?
|
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 void onProcessComplete(int exitValue)
ExecuteResultHandler
onProcessComplete
在接口中 ExecuteResultHandler
exitValue
- the exit value of the sub-processExecuteResultHandler.onProcessComplete(int)
public void onProcessFailed(ExecuteException e)
ExecuteResultHandler
onProcessFailed
在接口中 ExecuteResultHandler
e
- the ExecuteException
containing the root causeExecuteResultHandler.onProcessFailed(com.sh.common.exec.ExecuteException)
public ExecuteException getException()
java.lang.IllegalStateException
- if the process has not exited yetpublic int getExitValue()
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.