void handleContainerStop(String processorId, String containerId, String preferredHost, int exitStatus,
      Duration preferredHostRetryDelay, ContainerAllocator containerAllocator) {
    if (hasActiveContainerPlacementAction(processorId)) {
      ContainerPlacementMetadata metadata = getPlacementActionMetadata(processorId).get();
      LOG.info("Setting the container state with Processor ID: {} to be stopped because of existing ContainerPlacement action: {}",
          processorId, metadata);
      metadata.setContainerStatus(ContainerPlacementMetadata.ContainerStatus.STOPPED);
    } else if (standbyContainerManager.isPresent()) {
      standbyContainerManager.get()
          .handleContainerStop(processorId, containerId, preferredHost, exitStatus, containerAllocator,
              preferredHostRetryDelay);
    } else {
      // If StandbyTasks are not enabled, we simply make a request for the preferredHost
      containerAllocator.requestResourceWithDelay(processorId, preferredHost, preferredHostRetryDelay);
    }
  }
Handles the action to be taken after the container has been stopped. If stop was issued due to existing control
action, mark the container as stopped, otherwise

Case 1. When standby is enabled, refer to {@link StandbyContainerManager#handleContainerStop} to check constraints.
Case 2. When standby is disabled there are two cases according to host-affinity being enabled
   Case 2.1. When host-affinity is enabled resources are requested on host where container was last seen
   Case 2.2. When host-affinity is disabled resources are requested for ANY_HOST

@param processorId logical id of the container eg 1,2,3
@param containerId last known id of the container deployed
@param preferredHost host on which container was last deployed
@param exitStatus exit code returned by the container
@param preferredHostRetryDelay delay to be incurred before requesting resources
@param containerAllocator allocator for requesting resources
samza-core/src/main/java/org/apache/samza/clustermanager/ContainerManager.java