INVALID_EXITVALUE| 构造器和说明 |
|---|
DefaultExecutor()
Default constructor creating a default
PumpStreamHandler
and sets the working directory of the subprocess to the current
working directory. |
DefaultExecutor(ExecuteStreamHandler streamHandler) |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
execute(CommandLine command)
Methods for starting synchronous execution.
|
void |
execute(CommandLine command,
ExecuteResultHandler handler)
Methods for starting asynchronous execution.
|
int |
execute(CommandLine command,
java.util.Map environment)
Methods for starting synchronous execution.
|
void |
execute(CommandLine command,
java.util.Map environment,
ExecuteResultHandler handler)
Methods for starting asynchronous execution.
|
ProcessDestroyer |
getProcessDestroyer()
Set the handler for cleanup of started processes if the main process
is going to terminate.
|
ExecuteStreamHandler |
getStreamHandler()
Get the StreamHandler used for providing input and
retrieving the output.
|
ExecuteWatchdog |
getWatchdog()
Get the watchdog used to kill of processes running,
typically, too long time.
|
java.io.File |
getWorkingDirectory()
Get the working directory of the created process.
|
boolean |
isFailure(int exitValue)
Checks whether
exitValue signals a failure. |
void |
setExitValue(int value)
Define the
exitValue of the process to be considered
successful. |
void |
setExitValues(int[] values)
Define a list of
exitValue of the process to be considered
successful. |
void |
setProcessDestroyer(ProcessDestroyer processDestroyer)
Get the handler for cleanup of started processes if the main process
is going to terminate.
|
void |
setStreamHandler(ExecuteStreamHandler streamHandler)
Set a custom the StreamHandler used for providing
input and retrieving the output.
|
void |
setWaitFor(boolean waitFor) |
void |
setWatchdog(ExecuteWatchdog watchDog)
Set the watchdog used to kill of processes running,
typically, too long time.
|
void |
setWorkingDirectory(java.io.File dir)
Set the working directory of the created process.
|
public DefaultExecutor()
PumpStreamHandler
and sets the working directory of the subprocess to the current
working directory.
The PumpStreamHandler pumps the output of the subprocess
into our System.out and System.err to avoid
into our System.out and System.err to avoid
a blocked or deadlocked subprocess (seeProcess).public DefaultExecutor(ExecuteStreamHandler streamHandler)
public void setWaitFor(boolean waitFor)
public ExecuteStreamHandler getStreamHandler()
ExecutorgetStreamHandler 在接口中 ExecutorExecutor.getStreamHandler()public void setStreamHandler(ExecuteStreamHandler streamHandler)
ExecutorProcess).setStreamHandler 在接口中 ExecutorstreamHandler - the stream handlerExecutor.setStreamHandler(com.sh.common.exec.ExecuteStreamHandler)public ExecuteWatchdog getWatchdog()
ExecutorgetWatchdog 在接口中 ExecutorExecutor.getWatchdog()public void setWatchdog(ExecuteWatchdog watchDog)
ExecutorsetWatchdog 在接口中 ExecutorwatchDog - the watchdogExecutor.setWatchdog(com.sh.common.exec.ExecuteWatchdog)public ProcessDestroyer getProcessDestroyer()
ExecutorgetProcessDestroyer 在接口中 ExecutorExecutor.getProcessDestroyer()public void setProcessDestroyer(ProcessDestroyer processDestroyer)
ExecutorsetProcessDestroyer 在接口中 ExecutorprocessDestroyer - the ProcessDestroyerExecutor.setProcessDestroyer(ProcessDestroyer)public java.io.File getWorkingDirectory()
ExecutorgetWorkingDirectory 在接口中 ExecutorExecutor.getWorkingDirectory()public void setWorkingDirectory(java.io.File dir)
ExecutorsetWorkingDirectory 在接口中 Executordir - the working directoryExecutor.setWorkingDirectory(java.io.File)public int execute(CommandLine command) throws ExecuteException, java.io.IOException
Executorexecute 在接口中 Executorcommand - the command to executeExecuteException - execution of subprocess failed or the
subprocess returned a exit value indicating a failure
Executor.setExitValue(int).java.io.IOExceptionExecutor.execute(CommandLine)public int execute(CommandLine command, java.util.Map environment) throws ExecuteException, java.io.IOException
Executorexecute 在接口中 Executorenvironment - 追加的环境变量command - the command to executeExecuteException - execution of subprocess failed or the
subprocess returned a exit value indicating a failure
Executor.setExitValue(int).java.io.IOExceptionExecutor.execute(CommandLine, java.util.Map)public void execute(CommandLine command, ExecuteResultHandler handler) throws ExecuteException, java.io.IOException
Executorexecute 在接口中 Executorcommand - the command to executehandler - capture process termination and exit codeExecuteException - execution of subprocess failedjava.io.IOExceptionExecutor.execute(CommandLine,
com.sh.common.exec.ExecuteResultHandler)public void execute(CommandLine command, java.util.Map environment, ExecuteResultHandler handler) throws ExecuteException, java.io.IOException
Executorexecute 在接口中 Executorcommand - the command to executeenvironment - The environment for the new process. If null, the
environment of the current process is used.handler - capture process termination and exit codeExecuteException - execution of subprocess failedjava.io.IOExceptionExecutor.execute(CommandLine,
java.util.Map, com.sh.common.exec.ExecuteResultHandler)public void setExitValue(int value)
ExecutorexitValue of the process to be considered
successful. If a different exit value is returned by
the process then Executor.execute(CommandLine)
will throw an ExecuteExceptionsetExitValue 在接口中 Executorvalue - the exit code representing successful executionExecutor.setExitValue(int)public void setExitValues(int[] values)
ExecutorexitValue of the process to be considered
successful. The caller can pass one of the following values
Executor.isFailure(int)Executor.execute(CommandLine) will
throw an ExecuteException.setExitValues 在接口中 Executorvalues - a list of the exit codesExecutor.setExitValues(int[])public boolean isFailure(int exitValue)
ExecutorexitValue signals a failure. If no
exit values are set than the default conventions of the OS is
used. e.g. most OS regard an exit code of '0' as successful
execution and everything else as failure.isFailure 在接口中 ExecutorexitValue - the exit value (return code) to be checkedtrue if exitValue signals a failureExecutor.isFailure(int)