use terminateWithIds in terminate

This commit is contained in:
fjy 2014-01-20 16:58:53 -08:00
parent 1d81ad2946
commit ebc66df27d
1 changed files with 5 additions and 22 deletions

View File

@ -155,32 +155,15 @@ public class EC2AutoScalingStrategy implements AutoScalingStrategy
}
try {
log.info("Terminating instances[%s]", instances);
amazonEC2Client.terminateInstances(
new TerminateInstancesRequest(
Lists.transform(
instances,
new Function<Instance, String>()
{
@Override
public String apply(Instance input)
{
return input.getInstanceId();
}
}
)
)
);
return new AutoScalingData(
return terminateWithIds(
Lists.transform(
ips,
new Function<String, String>()
instances,
new Function<Instance, String>()
{
@Override
public String apply(@Nullable String input)
public String apply(Instance input)
{
return String.format("%s:%s", input, config.getWorkerPort());
return input.getInstanceId();
}
}
)