if (iterator.hasNext()) {
LOG.warn("Found more than one instance of {} running; stopping the others", serviceName);
for (; iterator.hasNext(); ) {
TwillController controller = iterator.next();
LOG.warn("Stopping one extra instance of {}", serviceName);
controller.stopAndWait();
}
LOG.warn("Stopped extra instances of {}", serviceName);
}
} else {
LOG.info("Starting {} application", serviceName);