code: public void checkExecutorHealth() {
      final Map<Optional<Executor>, List<ExecutableFlow>> exFlowMap = getFlowToExecutorMap();
      for (final Map.Entry<Optional<Executor>, List<ExecutableFlow>> entry : exFlowMap.entrySet()) {
        final Optional<Executor> executorOption = entry.getKey();
        if (!executorOption.isPresent()) {
          final String finalizeReason = "Executor id of this execution doesn't exist.";
          for (final ExecutableFlow flow : entry.getValue()) {
            logger.warn(
                String.format("Finalizing execution %s, %s", flow.getExecutionId(), finalizeReason));
            ExecutionControllerUtils
                .finalizeFlow(this.executorLoader, this.alerterHolder, flow, finalizeReason, null);
          }
          continue;
        }
  
        final Executor executor = executorOption.get();
        try {
          // Todo jamiesjc: add metrics to monitor the http call return time
          final Map<String, Object> results = this.apiGateway
              .callWithExecutionId(executor.getHost(), executor.getPort(),
                  ConnectorParams.PING_ACTION, null, null);
          if (results == null || results.containsKey(ConnectorParams.RESPONSE_ERROR) || !results
              .containsKey(ConnectorParams.STATUS_PARAM) || !results.get(ConnectorParams.STATUS_PARAM)
              .equals(ConnectorParams.RESPONSE_ALIVE)) {
            throw new ExecutorManagerException("Status of executor " + executor.getId() + " is "
                + "not alive.");
          } else {
            // Executor is alive. Clear the failure count.
            if (this.executorFailureCount.containsKey(executor.getId())) {
              this.executorFailureCount.put(executor.getId(), 0);
            }
          }
        } catch (final ExecutorManagerException e) {
          handleExecutorNotAliveCase(entry, executor, e);
        }
      }
    }
docs: Checks executor health. Finalizes the flow if its executor is already removed from DB or
  sends alert emails if the executor isn't alive any more.