Source:
<code>protected void waitForDependenciesStart(Instance instance) { List<Long> instancesIds = DataAccessor.fieldLongList(instance, DockerInstanceConstants.FIELD_VOLUMES_FROM); Long networkFromId = DataAccessor.fieldLong(instance, DockerInstanceConstants.FIELD_NETWORK_CONTAINER_ID); if (networkFromId != null) { instancesIds.add(networkFromId); } List<Instance> waitList = new ArrayList<>(); for (Long id : instancesIds) { Instance i = objectManager.loadResource(Instance.class, id); String type = networkFromId != null && networkFromId.equals(id) ? "networkFrom" : "volumeFrom"; if (REMOVED_STATES.contains(i.getState())) { throw new ExecutionException("Dependencies readiness error", type + " instance is removed", instance.getId()); } if (!isStartOnce(i) && !serviceDao.isServiceInstance(instance) && STOPPED_STATES.contains(i.getState())) { throw new ExecutionException("Dependencies readiness error", type + " instance is not running", instance.getId()); } waitList.add(i); } Long timeout = 120000L; for (Instance wait : waitList) { try { resourceMonitor.waitFor(wait, timeout, new ResourcePredicate<Instance>() { @Override public boolean evaluate(Instance obj) { <START> InstanceHostMap ihm = objectManager.findAny(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, obj.getId(), <END> INSTANCE_HOST_MAP.STATE, CommonStatesConstants.ACTIVE, INSTANCE_HOST_MAP.REMOVED, null); return ihm != null; } @Override public String getMessage() { return "running state"; } } ); } catch (TimeoutException e) { throw new ExecutionException("Dependencies readiness error", "instance is not running", instance.getId()); } } }</code><technical_language>I is account "startOnce" containers before. In this situation ihm "inactive" valid</technical_language>

Target:
protected void waitForDependenciesStart(Instance instance) { List<Long> instancesIds = DataAccessor.fieldLongList(instance, DockerInstanceConstants.FIELD_VOLUMES_FROM); Long networkFromId = DataAccessor.fieldLong(instance, DockerInstanceConstants.FIELD_NETWORK_CONTAINER_ID); if (networkFromId != null) { instancesIds.add(networkFromId); } List<Instance> waitList = new ArrayList<>(); for (Long id : instancesIds) { Instance i = objectManager.loadResource(Instance.class, id); String type = networkFromId != null && networkFromId.equals(id) ? "networkFrom" : "volumeFrom"; if (REMOVED_STATES.contains(i.getState())) { throw new ExecutionException("Dependencies readiness error", type + " instance is removed", instance.getId()); } if (!isStartOnce(i) && !serviceDao.isServiceInstance(instance) && STOPPED_STATES.contains(i.getState())) { throw new ExecutionException("Dependencies readiness error", type + " instance is not running", instance.getId()); } waitList.add(i); } Long timeout = 120000L; for (Instance wait : waitList) { try { resourceMonitor.waitFor(wait, timeout, new ResourcePredicate<Instance>() { @Override public boolean evaluate(Instance obj) { if (isStartOnce(obj)) { return START_ONCE_STATES.contains(obj.getState()); } InstanceHostMap ihm = objectManager.findAny(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, obj.getId(), INSTANCE_HOST_MAP.STATE, CommonStatesConstants.ACTIVE, INSTANCE_HOST_MAP.REMOVED, null); return ihm != null; } @Override public String getMessage() { return "running state"; } } ); } catch (TimeoutException e) { throw new ExecutionException("Dependencies readiness error", "instance is not running", instance.getId()); } } }