Source:
<code>public void registerContainerPlacementAction(ContainerPlacementRequestMessage requestMessage, ContainerAllocator containerAllocator) { LOG.info("Received ControlAction request to move or restart container with processor id to host {}", requestMessage.getProcessorId(), requestMessage.getDestinationHost()); String processorId = requestMessage.getProcessorId(); String destinationHost = requestMessage.getDestinationHost(); <START> Pair<ContainerPlacementMessage.StatusCode, String> actionStatus = checkValidControlAction(processorId, destinationHost, requestMessage.getUuid()); <END> if (actionStatus.getKey() == ContainerPlacementMessage.StatusCode.BAD_REQUEST) { return; } SamzaResource currentResource = samzaApplicationState.runningProcessors.get(processorId); LOG.info("Processor ID: matched a active container with deployment ID: running on host: {}", processorId, currentResource.getContainerId(), currentResource.getHost()); if (destinationHost.equals(ANY_HOST) || !hostAffinityEnabled) { LOG.info("Changing the requested host to because either it is requested or host affinity is disabled", ResourceRequestState.ANY_HOST); destinationHost = ANY_HOST; } SamzaResourceRequest resourceRequest = containerAllocator.getResourceRequest(processorId, destinationHost); Optional<Duration> requestExpiry = requestMessage.getRequestExpiry() != null ? Optional.of(Duration.ofMillis(requestMessage.getRequestExpiry())) : Optional.empty(); ContainerPlacementMetadata actionMetaData = new ContainerPlacementMetadata(requestMessage.getUuid(), processorId, currentResource.getContainerId(), currentResource.getHost(), destinationHost, requestExpiry); actionMetaData.setActionStatus(ContainerPlacementMessage.StatusCode.IN_PROGRESS, "Preferred Resources requested"); actionMetaData.recordResourceRequest(resourceRequest); actions.put(processorId, actionMetaData); containerAllocator.issueResourceRequest(resourceRequest); LOG.info("Container Placement action with metadata and issued a request for resources in progress", actionMetaData); }</code><technical_language>this return a pair, actionStatus.getValue is used</technical_language>

Target:
public void registerContainerPlacementAction(ContainerPlacementRequestMessage requestMessage, ContainerAllocator containerAllocator) { LOG.info("Received a ContainerPlacement action request: {}", requestMessage); String processorId = requestMessage.getProcessorId(); String destinationHost = requestMessage.getDestinationHost(); Pair<ContainerPlacementMessage.StatusCode, String> actionStatus = checkValidControlAction(processorId, destinationHost, requestMessage.getUuid()); if (actionStatus.getKey() == ContainerPlacementMessage.StatusCode.BAD_REQUEST) { 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.setActionStatus(ContainerPlacementMessage.StatusCode.IN_PROGRESS, "Preferred Resources requested"); actionMetaData.recordResourceRequest(resourceRequest); actions.put(processorId, actionMetaData); containerAllocator.issueResourceRequest(resourceRequest); LOG.info("Issued resource request for preferred resources for ContainerPlacement action: {}", actionMetaData); }