org.apache.tinkerpop.gremlin.server.handler

## Class UnifiedHandler

- java.lang.Object
- - <any>
  - - org.apache.tinkerpop.gremlin.server.handler.UnifiedHandler

-     public class UnifiedHandler
      extends <any>

  Handler for websockets to be used with the `UnifiedChannelizer`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Channelizer` | `channelizer`
    `protected GraphManager` | `graphManager`
    `protected GremlinExecutor` | `gremlinExecutor`
    `protected static Set<String>` | `INVALID_BINDINGS_KEYS` This may or may not be the full set of invalid binding keys.
    `protected ScheduledExecutorService` | `scheduledExecutorService`
    `protected ExecutorService` | `sessionExecutor`
    `protected ConcurrentMap<String,Session>` | `sessions`
    `protected Settings` | `settings`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnifiedHandler(Settings settings, GraphManager graphManager, GremlinExecutor gremlinExecutor, ScheduledExecutorService scheduledExecutorService, Channelizer channelizer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `channelRead0(ChannelHandlerContext ctx, RequestMessage msg)`
    `protected Session` | `createMultiTaskSession(SessionTask sessionTask, String sessionId)` Called when creating a `Session` that will be long-lived to extend over multiple requests and therefore process the provided `SessionTask` as well as ones that may arrive in the future.
    `protected Session` | `createSingleTaskSession(SessionTask sessionTask, String sessionId)` Called when creating a single task session where the provided `SessionTask` will be the only one to be executed and can therefore take a more efficient execution path.
    `int` | `getActiveSessionCount()`
    `boolean` | `isActiveSession(String sessionId)`
    `void` | `userEventTriggered(ChannelHandlerContext ctx, Object evt)`
    `protected void` | `validateRequest(RequestMessage message, GraphManager graphManager)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### settings

          protected final Settings settings

    - #### graphManager

          protected final GraphManager graphManager

    - #### gremlinExecutor

          protected final GremlinExecutor gremlinExecutor

    - #### scheduledExecutorService

          protected final ScheduledExecutorService scheduledExecutorService

    - #### sessionExecutor

          protected final ExecutorService sessionExecutor

    - #### channelizer

          protected final Channelizer channelizer

    - #### sessions

          protected final ConcurrentMap<String,Session> sessions

    - #### INVALID_BINDINGS_KEYS

          protected static final Set<String> INVALID_BINDINGS_KEYS

      This may or may not be the full set of invalid binding keys. It is dependent on the static imports made to Gremlin Server. This should get rid of the worst offenders though and provide a good message back to the calling client.

      Use of `toUpperCase()` on the accessor values of `T` solves an issue where the `ScriptEngine` ignores private scope on `T` and imports static fields.

  - ### Constructor Detail

    - #### UnifiedHandler

          public UnifiedHandler(Settings settings,
                                GraphManager graphManager,
                                GremlinExecutor gremlinExecutor,
                                ScheduledExecutorService scheduledExecutorService,
                                Channelizer channelizer)

  - ### Method Detail

    - #### channelRead0

          protected void channelRead0(ChannelHandlerContext ctx,
                                      RequestMessage msg)
                               throws Exception

      Throws:
        `Exception`

    - #### validateRequest

          protected void validateRequest(RequestMessage message,
                                         GraphManager graphManager)
                                  throws SessionException

      Throws:
        `SessionException`

    - #### userEventTriggered

          public void userEventTriggered(ChannelHandlerContext ctx,
                                         Object evt)
                                  throws Exception

      Throws:
        `Exception`

    - #### createSingleTaskSession

          protected Session createSingleTaskSession(SessionTask sessionTask,
                                                    String sessionId)

      Called when creating a single task session where the provided `SessionTask` will be the only one to be executed and can therefore take a more efficient execution path.

    - #### createMultiTaskSession

          protected Session createMultiTaskSession(SessionTask sessionTask,
                                                   String sessionId)

      Called when creating a `Session` that will be long-lived to extend over multiple requests and therefore process the provided `SessionTask` as well as ones that may arrive in the future.

    - #### isActiveSession

          public boolean isActiveSession(String sessionId)

    - #### getActiveSessionCount

          public int getActiveSessionCount()

Copyright © 2013–2021 Apache Software Foundation. All rights reserved.