@Override
  public void onNext(
      final RemoteMessage<ReefServiceProtos.RuntimeErrorProto> runtimeErrorProtoRemoteMessage) {
    final ReefServiceProtos.RuntimeErrorProto runtimeErrorProto =
        runtimeErrorProtoRemoteMessage.getMessage();
    final FailedRuntime error = new FailedRuntime(runtimeErrorProto);
    final String evaluatorId = error.getId();
    LOG.log(Level.WARNING, "Runtime error: " + error);

    final EvaluatorException evaluatorException =
        error.getReason().isPresent()
            ? new EvaluatorException(evaluatorId, error.getReason().get())
            : new EvaluatorException(evaluatorId, "Runtime error");

    final Optional<EvaluatorManager> evaluatorManager = this.evaluators.get(evaluatorId);
    if (evaluatorManager.isPresent()) {
      evaluatorManager.get().onEvaluatorException(evaluatorException);
    } else {
      if (this.evaluators.wasClosed(evaluatorId)) {
        LOG.log(
            Level.WARNING,
            "Evaluator [" + evaluatorId + "] has raised exception after it was closed.");
      } else {
        LOG.log(Level.WARNING, "Unknown evaluator runtime error: " + error);
      }
    }
  }
 private ResourceRequestEventImpl(final Builder builder) {
   this.resourceCount = BuilderUtils.notNull(builder.resourceCount);
   this.nodeNameList = BuilderUtils.notNull(builder.nodeNameList);
   this.rackNameList = BuilderUtils.notNull(builder.rackNameList);
   this.memorySize = Optional.ofNullable(builder.memorySize);
   this.priority = Optional.ofNullable(builder.priority);
   this.virtualCores = Optional.ofNullable(builder.virtualCores);
   this.relaxLocality = Optional.ofNullable(builder.relaxLocality);
 }
 private ResourceStatusEventImpl(final Builder builder) {
   this.identifier = BuilderUtils.notNull(builder.identifier);
   this.state = BuilderUtils.notNull(builder.state);
   this.diagnostics = Optional.ofNullable(builder.diagnostics);
   this.exitCode = Optional.ofNullable(builder.exitCode);
 }