LOG.warn("No running container found for {}", runnableName);
return;
}
String lastContainerId = null;
TwillContainerController lastController = null;
// Find the controller with the maxInstanceId
for (Map.Entry<String, TwillContainerController> entry : containers.row(runnableName).entrySet()) {
if (getInstanceId(entry.getValue().getRunId()) == maxInstanceId) {
lastContainerId = entry.getKey();
lastController = entry.getValue();
break;
}
}
Preconditions.checkState(lastContainerId != null,
"No container found for {} with instanceId = {}", runnableName, maxInstanceId);
LOG.info("Stopping service: {} {}", runnableName, lastController.getRunId());
lastController.stopAndWait();
containers.remove(runnableName, lastContainerId);
removeInstanceId(runnableName, maxInstanceId);
resourceReport.removeRunnableResources(runnableName, lastContainerId);
containerChange.signalAll();
} finally {