org.apache.tinkerpop.gremlin.server.handler

## Class SingleTaskSession

- java.lang.Object
- - org.apache.tinkerpop.gremlin.server.handler.AbstractSession
  - - org.apache.tinkerpop.gremlin.server.handler.SingleTaskSession

- All Implemented Interfaces:
    AutoCloseable, Runnable, Session

      public class SingleTaskSession
      extends AbstractSession

  A simple `Session` implementation that accepts one request, processes it and exits.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.tinkerpop.gremlin.server.handler.AbstractSession

      `AbstractSession.CloseReason`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SessionTask` | `onlySessionTask`

    - ### Fields inherited from class org.apache.tinkerpop.gremlin.server.handler.AbstractSession

      `aliasesUsedBySession, closeReason, graphManager, maintainStateAfterException, sessions, sessionThread`

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.server.handler.Session

      `evalOpTimer, traversalOpTimer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SingleTaskSession(SessionTask onlySessionTask, String sessionId, ConcurrentMap<String,Session> sessions)` Constructs a `SingleTaskSession` that has the task to execute supplied on construction.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isAcceptingTasks()` The `SingleWorker` can only process one request so the initial construction of it already has the request in it and no more can be added, therefore this method always return `false`.
    `void` | `run()`
    `boolean` | `submitTask(SessionTask sessionTask)` This implementation only take a single `SessionTask` on construction - no additional tasks can be submitted.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.server.handler.AbstractSession

      `cancel, close, closeTransaction, closeTransaction, closeTransactionSafely, closeTransactionSafely, determineIfTemporaryException, fromBytecode, fromScript, generateResponseMetaData, generateStatusAttributes, getActualTimeoutLengthWhenClosed, getCloseReason, getScriptEngine, getSessionId, getWorkerBindings, handleException, handleGraphOperation, handleIterator, isBoundTo, isTransactionManaged, iterateComplete, makeFrame, mergeBindingsFromRequest, process, setSessionCancelFuture, setSessionFuture, startTransaction, triggerTimeout`

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

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

- - ### Field Detail

    - #### onlySessionTask

          protected final SessionTask onlySessionTask

  - ### Constructor Detail

    - #### SingleTaskSession

          public SingleTaskSession(SessionTask onlySessionTask,
                                   String sessionId,
                                   ConcurrentMap<String,Session> sessions)

      Constructs a `SingleTaskSession` that has the task to execute supplied on construction.

  - ### Method Detail

    - #### isAcceptingTasks

          public boolean isAcceptingTasks()

      The `SingleWorker` can only process one request so the initial construction of it already has the request in it and no more can be added, therefore this method always return `false`.

    - #### submitTask

          public boolean submitTask(SessionTask sessionTask)
                             throws RejectedExecutionException

      This implementation only take a single `SessionTask` on construction - no additional tasks can be submitted.
      Throws:
        `RejectedExecutionException` - if the task cannot be queued

    - #### run

          public void run()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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