use of com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations in project ats-framework by Axway.
the class ProcessExecutor method killExternalProcess.
/**
* Killing external process(such not started by us) on a remote host. <br/>
* The process is found by a token which is contained in the start command.
* No regex supported.
*
* @param atsAgent the address of the remote ATS agent which will run the kill command
* @param startCommandSnippet the token to search for in the process start command.
* The minimum allowed length is 2 characters
* @return the number of killed processes
*/
@PublicAtsApi
public static int killExternalProcess(@Validate(name = "atsAgent", type = ValidationType.STRING_SERVER_WITH_PORT) String atsAgent, @Validate(name = "startCommandSnippet", type = ValidationType.STRING_NOT_EMPTY) String startCommandSnippet) {
// validate input parameters
atsAgent = HostUtils.getAtsAgentIpAndPort(atsAgent);
new Validator().validateMethodParameters(new Object[] { atsAgent, startCommandSnippet });
try {
return new InternalProcessOperations(atsAgent).killExternalProcess(startCommandSnippet);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
Aggregations