code: @Deprecated
    public synchronized void sendJobEndingMessageToClient(final Optional<Throwable> exception) {
  
      if (!this.isClosing()) {
        LOG.log(Level.SEVERE, "Sending message in a state different that SHUTTING_DOWN or FAILING. " +
            "This is likely a illegal call to clock.close() at play. Current state: {0}", this.driverStatus);
      }
  
      if (this.driverTerminationHasBeenCommunicatedToClient) {
        LOG.log(Level.SEVERE, ".sendJobEndingMessageToClient() called twice. Ignoring the second call");
        return;
      }
  
      // Log the shutdown situation
      if (this.shutdownCause.isPresent()) {
        LOG.log(Level.WARNING, "Sending message about an unclean driver shutdown.", this.shutdownCause.get());
      }
  
      if (exception.isPresent()) {
        LOG.log(Level.WARNING, "There was an exception during clock.close().", exception.get());
      }
  
      if (this.shutdownCause.isPresent() && exception.isPresent()) {
        LOG.log(Level.WARNING, "The driver is shutdown because of an exception (see above) and there was " +
            "an exception during clock.close(). Only the first exception will be sent to the client");
      }
  
      // Send the earlier exception, if there was one. Otherwise, send the exception passed.
      this.clientConnection.send(getJobEndingMessage(
          this.shutdownCause.isPresent() ? this.shutdownCause : exception));
  
      this.driverTerminationHasBeenCommunicatedToClient = true;
    }
docs: Sends the final message to the Driver. This is used by DriverRuntimeStopHandler.onNext().
  @param exception Exception that caused the job to end (can be absent).
  @deprecated TODO[JIRA REEF-1548] Do not use DriverStatusManager as a proxy to the job client.
  After release 0.16, make this method private and use it inside onRuntimeStop() method instead.