Source:
public void registerContainerPlacementAction(ContainerPlacementRequestMessage requestMessage, ContainerAllocator containerAllocator) { String processorId = requestMessage.getProcessorId(); String destinationHost = requestMessage.getDestinationHost(); Optional<Pair<ContainerPlacementMessage.StatusCode, String>> actionStatus = validatePlacementAction(requestMessage); if (!actionStatus.isPresent()) { LOG.info("ContainerPlacement request is en-queued metadata: {}", requestMessage); return; } LOG.info("ContainerPlacement action is de-queued metadata: {}", requestMessage); containerPlacementMetadataStore.deleteContainerPlacementRequestMessage(requestMessage.getUuid()); dequeuedActionsCache.put(requestMessage.getUuid()); if (actionStatus.get().getKey() == ContainerPlacementMessage.StatusCode.BAD_REQUEST) { writeContainerPlacementResponseMessage(requestMessage, actionStatus.get().getKey(), actionStatus.get().getValue()); return; } SamzaResource currentResource = samzaApplicationState.runningProcessors.get(processorId); LOG.info("Processor ID: matched an active container with deployment ID: is running on host: for ContainerPlacement action: {}", processorId, currentResource.getContainerId(), currentResource.getHost(), requestMessage); if (!hostAffinityEnabled) { LOG.info("Changing the requested host for placement action to because host affinity is disabled", ResourceRequestState.ANY_HOST); destinationHost = ANY_HOST; } SamzaResourceRequest resourceRequest = containerAllocator.getResourceRequest(processorId, destinationHost); ContainerPlacementMetadata actionMetaData = new ContainerPlacementMetadata(requestMessage, currentResource.getHost()); actionMetaData.recordResourceRequest(resourceRequest); actions.put(processorId, actionMetaData); updateContainerPlacementActionStatus(actionMetaData, ContainerPlacementMessage.StatusCode.IN_PROGRESS, "Preferred Resources requested"); containerAllocator.issueResourceRequest(resourceRequest); LOG.info("Issued resource request for preferred resources for ContainerPlacement action: {}", actionMetaData); }

Target:
public void registerContainerPlacementAction(ContainerPlacementRequestMessage requestMessage, ContainerAllocator containerAllocator) { String processorId = requestMessage.getProcessorId(); String destinationHost = requestMessage.getDestinationHost(); if (!deQueueAction(requestMessage)) { return; } Pair<ContainerPlacementMessage.StatusCode, String> actionStatus = validatePlacementAction(requestMessage); LOG.info("ContainerPlacement action is de-queued metadata: {}", requestMessage); placementRequestsCache.put(requestMessage.getUuid()); containerPlacementMetadataStore.deleteContainerPlacementRequestMessage(requestMessage.getUuid()); if (actionStatus.getKey() == ContainerPlacementMessage.StatusCode.BAD_REQUEST) { writeContainerPlacementResponseMessage(requestMessage, actionStatus.getKey(), actionStatus.getValue()); return; } SamzaResource currentResource = samzaApplicationState.runningProcessors.get(processorId); LOG.info("Processor ID: matched an active container with containerId ID: is running on host: for ContainerPlacement action: {}", processorId, currentResource.getContainerId(), currentResource.getHost(), requestMessage); if (!hostAffinityEnabled) { LOG.info("Changing the requested host for placement action to because host affinity is disabled", ResourceRequestState.ANY_HOST); destinationHost = ANY_HOST; } SamzaResourceRequest resourceRequest = containerAllocator.getResourceRequest(processorId, destinationHost); ContainerPlacementMetadata actionMetaData = new ContainerPlacementMetadata(requestMessage, currentResource.getHost()); actionMetaData.recordResourceRequest(resourceRequest); actions.put(processorId, actionMetaData); updateContainerPlacementActionStatus(actionMetaData, ContainerPlacementMessage.StatusCode.IN_PROGRESS, "Preferred Resources requested"); containerAllocator.issueResourceRequest(resourceRequest); LOG.info("Issued resource request for preferred resources for ContainerPlacement action: {}", actionMetaData); }