code: private synchronized void onNewContext(final ContextStatusPOJO contextStatus,
                                           final boolean notifyClientOnNewActiveContext) {
      final String contextID = contextStatus.getContextId();
      LOG.log(Level.FINE, "Adding new context {0}.", contextID);
  
      final Optional<String> parentID = contextStatus.hasParentId() ?
          Optional.of(contextStatus.getParentId()) : Optional.<String>empty();
      final EvaluatorContext context = contextFactory.newContext(contextID, parentID);
      this.addContext(context);
      if (notifyClientOnNewActiveContext) {
        if (driverRestartManager.getEvaluatorRestartState(context.getEvaluatorId())
            == EvaluatorRestartState.REREGISTERED) {
          // if restart, advance restart state and all the restart context active handlers.
          driverRestartManager.setEvaluatorProcessed(context.getEvaluatorId());
          this.messageDispatcher.onDriverRestartContextActive(context);
        }
  
        this.messageDispatcher.onContextActive(context);
      }
    }
docs: Create and add a new context representer.
  
  @param contextStatus             the message to create the context from
  @param notifyClientOnNewActiveContext whether or not to fire an event to the user.