org.apache.tinkerpop.gremlin.server.op.session

## Class Session

- java.lang.Object
- - org.apache.tinkerpop.gremlin.server.op.session.Session

-     public class Session
      extends Object

  Defines a "session" for the `SessionOpProcessor` which preserves state between requests made to Gremlin Server. Since transactions are bound to a single thread the "session" maintains its own thread to process Gremlin statements so that each request can be executed within it to preserve the transaction state from one request to the next.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Session(String session, Context context, ConcurrentHashMap<String,Session> sessions)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `acceptingRequests()`
    `Bindings` | `getBindings()`
    `ExecutorService` | `getExecutor()`
    `GremlinExecutor` | `getGremlinExecutor()`
    `String` | `getSessionId()`
    `boolean` | `isBoundTo(Channel channel)` Determines if the supplied `Channel` object is the same as the one bound to the `Session`.
    `void` | `kill(boolean force)` Kills the session and rollback any uncommitted changes on transactional graphs.
    `void` | `manualKill(boolean force)` Stops the session with call to `kill(boolean)` but also stops the session expiration call which ensures that the session is only killed once.
    `void` | `touch()`

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

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

- - ### Constructor Detail

    - #### Session

          public Session(String session,
                         Context context,
                         ConcurrentHashMap<String,Session> sessions)

  - ### Method Detail

    - #### isBoundTo

          public boolean isBoundTo(Channel channel)

      Determines if the supplied `Channel` object is the same as the one bound to the `Session`.

    - #### getGremlinExecutor

          public GremlinExecutor getGremlinExecutor()

    - #### getBindings

          public Bindings getBindings()

    - #### getExecutor

          public ExecutorService getExecutor()

    - #### getSessionId

          public String getSessionId()

    - #### acceptingRequests

          public boolean acceptingRequests()

    - #### touch

          public void touch()

    - #### manualKill

          public void manualKill(boolean force)

      Stops the session with call to `kill(boolean)` but also stops the session expiration call which ensures that the session is only killed once. See `kill(boolean)` for information on how what "forcing" the session kill will mean.

    - #### kill

          public void kill(boolean force)

      Kills the session and rollback any uncommitted changes on transactional graphs. When "force" closed, the session won't bother to try to submit transaction close commands. It will be up to the underlying graph implementation to determine how it will clean up orphaned transactions. The force will try to cancel scheduled jobs and interrupt any currently running ones. Interruption is not guaranteed, but an attempt will be made.

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