コード例 #1
0
  private void evalOp(final Context context) throws OpProcessorException {
    if (logger.isDebugEnabled()) {
      final RequestMessage msg = context.getRequestMessage();
      logger.debug(
          "Sessionless request {} for eval in thread {}",
          msg.getRequestId(),
          Thread.currentThread().getName());
    }

    evalOpInternal(context, context::getGremlinExecutor, bindingMaker.apply(context));
  }
コード例 #2
0
  protected void evalOp(final Context context) throws OpProcessorException {
    final RequestMessage msg = context.getRequestMessage();
    final Session session = getSession(context, msg);

    // place the session on the channel context so that it can be used during serialization.  in
    // this way
    // the serialization can occur on the same thread used to execute the gremlin within the
    // session.  this
    // is important given the threadlocal nature of Graph implementation transactions.
    context.getChannelHandlerContext().channel().attr(StateKey.SESSION).set(session);

    evalOpInternal(
        context,
        session::getGremlinExecutor,
        () -> {
          final Bindings bindings = session.getBindings();

          // parameter bindings override session bindings if present
          Optional.ofNullable((Map<String, Object>) msg.getArgs().get(Tokens.ARGS_BINDINGS))
              .ifPresent(bindings::putAll);

          return bindings;
        });
  }