Source:
public void syncAStack(Stack stack) { try { checkedMeasure(() -> { ThreadBasedUserCrnProvider.doAsInternalActor(() -> { Set<InstanceMetaData> notTerminatedForStack = stack.getAllInstanceMetaDataList().stream() .filter(Predicate.not(InstanceMetaData::isTerminated)) .collect(Collectors.toSet()); Set<InstanceMetaData> checkableInstances = notTerminatedForStack.stream() .filter(Predicate.not(InstanceMetaData::isDeletedOnProvider)) .collect(Collectors.toSet()); int alreadyDeletedCount = notTerminatedForStack.size() - checkableInstances.size(); if (alreadyDeletedCount > 0) { LOGGER.info(":::Auto sync::: Count of already in deleted on provider side state: {}", alreadyDeletedCount); } if (!checkableInstances.isEmpty()) { SyncResult syncResult = freeipaChecker.getStatus(stack, checkableInstances); if (DetailedStackStatus.AVAILABLE == syncResult.getStatus()) { for (Map.Entry<InstanceMetaData, DetailedStackStatus> entry : syncResult.getInstanceStatusMap().entrySet()) { updateInstanceStatus(entry.getKey(), entry.getValue()); } updateStackStatus(stack, syncResult, null, alreadyDeletedCount); } else { List<ProviderSyncResult> results = providerChecker.updateAndGetStatuses(stack, checkableInstances, syncResult.getInstanceStatusMap()); if (!results.isEmpty()) { updateStackStatus(stack, syncResult, results, alreadyDeletedCount); } else { LOGGER.debug("results is empty, skip update"); } } } else if (alreadyDeletedCount > 0) { SyncResult syncResult = new SyncResult("FreeIpa is " + DetailedStackStatus.DELETED_ON_PROVIDER_SIDE, DetailedStackStatus.DELETED_ON_PROVIDER_SIDE, null); updateStackStatus(stack, syncResult, null, alreadyDeletedCount); } freeipaStatusInfoLogger.logFreeipaStatus(stack, checkableInstances); }); return null; }, LOGGER, ":::Auto sync::: freeipa stack sync in {}ms"); } catch (Exception e) { LOGGER.info(":::Auto sync::: Error occurred during freeipa sync: {}", e.getMessage(), e); } }

Target:
public void syncAStack(Stack stack) { try { checkedMeasure(() -> { ThreadBasedUserCrnProvider.doAsInternalActor(() -> { Set<InstanceMetaData> notTerminatedForStack = stack.getAllInstanceMetaDataList().stream() .filter(Predicate.not(InstanceMetaData::isTerminated)) .collect(Collectors.toSet()); Set<InstanceMetaData> checkableInstances = notTerminatedForStack.stream() .filter(Predicate.not(InstanceMetaData::isDeletedOnProvider)) .collect(Collectors.toSet()); int alreadyDeletedCount = notTerminatedForStack.size() - checkableInstances.size(); if (alreadyDeletedCount > 0) { LOGGER.info(":::Auto sync::: Count of already in deleted on provider side state: {}", alreadyDeletedCount); } if (!checkableInstances.isEmpty()) { SyncResult syncResult = freeipaChecker.getStatus(stack, checkableInstances); if (DetailedStackStatus.AVAILABLE == syncResult.getStatus()) { for (Map.Entry<InstanceMetaData, DetailedStackStatus> entry : syncResult.getInstanceStatusMap().entrySet()) { updateInstanceStatus(entry.getKey(), entry.getValue()); } updateStackStatus(stack, syncResult, null, alreadyDeletedCount); } else { List<ProviderSyncResult> results = providerChecker.updateAndGetStatuses(stack, checkableInstances, syncResult.getInstanceStatusMap()); if (!results.isEmpty()) { updateStackStatus(stack, syncResult, results, alreadyDeletedCount); } else { LOGGER.debug("results is empty, skip update"); } } } else if (alreadyDeletedCount > 0) { SyncResult syncResult = new SyncResult("FreeIpa is " + DetailedStackStatus.DELETED_ON_PROVIDER_SIDE, DetailedStackStatus.DELETED_ON_PROVIDER_SIDE, null); updateStackStatus(stack, syncResult, null, alreadyDeletedCount); } freeipaStatusInfoLogger.logFreeipaStatus(stack.getId(), checkableInstances); }); return null; }, LOGGER, ":::Auto sync::: freeipa stack sync in {}ms"); } catch (Exception e) { LOGGER.info(":::Auto sync::: Error occurred during freeipa sync: {}", e.getMessage(), e); } }