code: public void onResourceReleased(final ResourceReleaseEvent resourceReleaseEvent) {
      String resourceRemoteId = getResourceRemoteId(resourceReleaseEvent.getIdentifier());
  
      // REEF Common will trigger a ResourceReleaseEvent even if the resource has failed. Since we know that the shim
      // has already failed, we can safely ignore this.
      if (this.failedResources.remove(resourceReleaseEvent.getIdentifier()) != null) {
        LOG.log(Level.INFO, "Received a ResourceReleaseEvent for a failed shim with resourceId = {0}. Ignoring.",
            resourceReleaseEvent.getIdentifier());
      } else if (this.evaluators.get(resourceReleaseEvent.getIdentifier()).isPresent()) {
        EventHandler<EvaluatorShimProtocol.EvaluatorShimControlProto> handler =
            this.remoteManager.getHandler(resourceRemoteId, EvaluatorShimProtocol.EvaluatorShimControlProto.class);
  
        LOG.log(Level.INFO, "Sending TERMINATE command to the shim with remoteId = {0}.", resourceRemoteId);
        handler.onNext(
            EvaluatorShimProtocol.EvaluatorShimControlProto
                .newBuilder()
                .setCommand(EvaluatorShimProtocol.EvaluatorShimCommand.TERMINATE)
                .build());
  
        this.updateRuntimeStatus();
      }
    }
docs: Event handler method for {@link ResourceReleaseEvent}. Sends a TERMINATE command to the appropriate evaluator shim.
  
  @param resourceReleaseEvent