@Override public void doPolling(Guid cmdId, List<Guid> childCmdIds) { RemoveVmPoolCommand<? extends VmPoolParametersBase> command = getCommand(cmdId); boolean anyFailed = false; for (Guid childCmdId : childCmdIds) { CommandEntity entity = CommandCoordinatorUtil.getCommandEntity(childCmdId); switch (entity.getCommandStatus()) { case ENDED_WITH_FAILURE: case FAILED: case EXECUTION_FAILED: case UNKNOWN: anyFailed = true; break; default: break; } } if (anyFailed) { command.setCommandStatus(CommandStatus.FAILED); } else { VmPool pool = DbFacade.getInstance().getVmPoolDao().get(command.getVmPoolId()); if (pool == null || pool.getRunningVmsCount() == 0) { command.setCommandStatus(CommandStatus.SUCCEEDED); } } }