@ProviderType
public interface CommandExecutorService
| Modifier and Type | Method and Description |
|---|---|
CommandStatus |
execute(Command command)
Synchronously executes a system command.
|
void |
execute(Command command,
java.util.function.Consumer<CommandStatus> callback)
Asynchronously executes a system command.
|
java.util.Map<java.lang.String,Pid> |
getPids(java.lang.String[] commandLine)
This method searches for running processes containing all the tokens in the command line.
|
boolean |
isRunning(Pid pid)
Returns true if the process identified by the given Pid is running.
|
boolean |
isRunning(java.lang.String[] commandLine)
Returns true if at least one process containing all the tokens in the given command line is found.
|
boolean |
kill(java.lang.String[] commandLine,
Signal signal)
Kills the system commands containing all the tokens in the given command line.
|
boolean |
stop(Pid pid,
Signal signal)
Stops the system process identified by the given
Pid. |
CommandStatus execute(Command command)
command - the Command to be executedCommandStatus objectvoid execute(Command command, java.util.function.Consumer<CommandStatus> callback)
command - the Command to be executedcallback - the consumer called when the command returnsboolean kill(java.lang.String[] commandLine,
Signal signal)
commandLine - the command to be killedsignal - the Signal sent to the command to kill it. If null, a default signal will be sent.
The type of the default signal is implementation specificboolean isRunning(Pid pid)
pid - the Pid object of the processboolean isRunning(java.lang.String[] commandLine)
commandLine - the command to be checkedjava.util.Map<java.lang.String,Pid> getPids(java.lang.String[] commandLine)
Pids.commandLine - the command linePid