Source:
boolean checkStandbyConstraints(String containerIdToStart, String host) { List<String> containerIDsForStandbyConstraints = this.standbyContainerConstraints.get(containerIdToStart); for (String containerID : containerIDsForStandbyConstraints) { SamzaResource resource = samzaApplicationState.pendingProcessors.get(containerID); if (resource != null) { if (!resource.getHost().equals(ResourceRequestState.ANY_HOST) && !host.equals(ResourceRequestState.ANY_HOST) && faultDomainManager.checkHostsOnSameFaultDomain(host, resource.getHost())) { log.info("Container cannot be started on host because container is already scheduled on this rack", containerIdToStart, host, containerID); return false; } else if (resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already scheduled on this host", containerIdToStart, host, containerID); return false; } } resource = samzaApplicationState.runningProcessors.get(containerID); if (resource != null) { if (!resource.getHost().equals(ResourceRequestState.ANY_HOST) && !host.equals(ResourceRequestState.ANY_HOST) && faultDomainManager.checkHostsOnSameFaultDomain(host, resource.getHost())) { log.info("Container cannot be started on host because container is already running on this rack", containerIdToStart, host, containerID); return false; } else if (resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already running on this host", containerIdToStart, host, containerID); return false; } } } return true; }

Target:
boolean checkStandbyConstraints(String containerIdToStart, String host) { List<String> containerIDsForStandbyConstraints = this.standbyContainerConstraints.get(containerIdToStart); for (String containerID : containerIDsForStandbyConstraints) { SamzaResource resource = samzaApplicationState.pendingProcessors.get(containerID); if (resource != null && isFaultDomainAwareStandbyEnabled && faultDomainManager.hasSameFaultDomains(host, resource.getHost())) { log.info("Container cannot be started on host because container is already scheduled on this fault domain", containerIdToStart, host, containerID); if (StandbyTaskUtil.isStandbyContainer(containerIdToStart)) { samzaApplicationState.failedFaultDomainAwareContainerAllocations.incrementAndGet(); } return false; } else if (resource != null && resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already scheduled on this host", containerIdToStart, host, containerID); return false; } resource = samzaApplicationState.runningProcessors.get(containerID); if (resource != null && isFaultDomainAwareStandbyEnabled && faultDomainManager.hasSameFaultDomains(host, resource.getHost())) { log.info("Container cannot be started on host because container is already running on this fault domain", containerIdToStart, host, containerID); if (StandbyTaskUtil.isStandbyContainer(containerIdToStart)) { samzaApplicationState.failedFaultDomainAwareContainerAllocations.incrementAndGet(); } return false; } else if (resource != null && resource.getHost().equals(host)) { log.info("Container cannot be started on host because container is already running on this host", containerIdToStart, host, containerID); return false; } } return true; }