Search in sources :

Example 1 with InternalProcessOperations

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);
    }
}
Also used : InternalProcessOperations(com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations) AgentException(com.axway.ats.agent.core.exceptions.AgentException) ProcessExecutorException(com.axway.ats.common.process.ProcessExecutorException) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

InternalProcessOperations (com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations)1 AgentException (com.axway.ats.agent.core.exceptions.AgentException)1 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 ProcessExecutorException (com.axway.ats.common.process.ProcessExecutorException)1 Validator (com.axway.ats.core.validation.Validator)1