Interface ProcessExecutor
-
- All Known Implementing Classes:
AbstractProcessExecutor,BasicProcessExecutor,EmbeddedProcessExecutor,LimitedProcessExecutor,ProcessExecutorClient
public interface ProcessExecutorService to efficiently execute operation system level processes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intexecute(ProcessContext ctx)Synchronously executes the givenProcessContext.intexecute(java.lang.String[] command, java.lang.String[] environment, java.io.File directory, Drain stdOutput, Drain stdError)Synchronously executes the given command in the given environment and directory.voidquit()Terminates thisProcessExecutorand frees all associated resources.
-
-
-
Method Detail
-
execute
int execute(java.lang.String[] command, java.lang.String[] environment, java.io.File directory, Drain stdOutput, Drain stdError) throws java.io.IOExceptionSynchronously executes the given command in the given environment and directory.- Parameters:
command- the command line to execute/environment- the environment to usedirectory- the directory to execute the command instdOutput- callback handle to process the processes standard outputstdError- callback handle to process the processes standard error output- Returns:
- the exit code of the process
- Throws:
java.io.IOException- on any error executing the process.- See Also:
Runtime.exec(String[], String[], File)
-
execute
int execute(ProcessContext ctx) throws java.io.IOException
Synchronously executes the givenProcessContext.- Parameters:
ctx- the context to execute- Returns:
- the exit code of the underlying os process.
- Throws:
java.io.IOException- on eny error while executing the process.
-
quit
void quit() throws java.io.IOException
Terminates thisProcessExecutorand frees all associated resources. Note the lifecycle of aProcessExecutorhas tenant scope, i.e. there is no need to callquit()except when shutting down the server (what will be done automatically).- Throws:
java.io.IOException- on any error
-
-