class InstanceFailureStepDefinitions implements EC2StepFunctions {

    @When("^stop (service|process) \"([^\"]*)\" on (\\d+) instance$")
    public InstanceFailureStepDefinitions stopProcessOnHealthyInstances(String serviceOrProcessType, String processName, int numHosts) {
        List<EC2InstanceTO> instances = executionStateCache.getInstances();

        List<String> processList = new ArrayList<String>(Arrays.asList(processName.split(",")));


        if (instances == null || instances.isEmpty())
        {
            throw new RuntimeException("No Instances are vailable");
        }

        executionStateCache.addProcessName(processName);

        if (numHosts > instances.size()) {
            numHosts = instances.size();
        }


        for(String process : processList)
        {
        	logger.info("stopping process: "+ process + "on " + numHosts + " instances ");
        	stopProcess(process.trim(),numHosts,instances);

        }


        return this;
    }

    public  InstanceFailureStepDefinitions();

}