Class AbstractSession
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.server.handler.AbstractSession
 
- 
- All Implemented Interfaces:
- AutoCloseable,- Runnable,- Session
 - Direct Known Subclasses:
- MultiTaskSession,- SingleTaskSession
 
 @Deprecated public abstract class AbstractSession extends Object implements Session, AutoCloseable Deprecated.As of release 3.8.0, not replaced.A base implementation ofSessionwhich offers some common functionality that matches typical Gremlin Server request response expectations for script, bytecode and graph operations. The class is designed to be extended but take care in understanding the way that different methods are called as they do depend on one another a bit. It maybe best to examine the source code to determine how best to use this class or to extend from the higher order classes ofSingleTaskSessionorMultiTaskSession.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static classAbstractSession.CloseReasonDeprecated.The reason that a particular session closed.
 - 
Field SummaryFields Modifier and Type Field Description protected Set<String>aliasesUsedBySessionDeprecated.protected AtomicReference<AbstractSession.CloseReason>closeReasonDeprecated.protected GraphManagergraphManagerDeprecated.protected booleanmaintainStateAfterExceptionDeprecated.protected ConcurrentMap<String,Session>sessionsDeprecated.protected AtomicBooleansessionTaskStartedDeprecated.protected ThreadsessionThreadDeprecated.The session thread is a reference to the thread that is running the session and should be set by an implementation as the first line of theRunnable.run()method.- 
Fields inherited from interface org.apache.tinkerpop.gremlin.server.handler.SessionevalOpTimer, traversalOpTimer
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcancel(boolean mayInterruptIfRunning)Deprecated.voidclose()Deprecated.Removes the session from the session list and cancels the future that manages the lifetime of the session.protected voidcloseTransaction(SessionTask sessionTask, Transaction.Status status)Deprecated.Closes a transaction with commit or rollback.protected voidcloseTransaction(Transaction.Status status)Deprecated.Close the transaction without aSessionTaskwhich suppliesnullto that argument forcloseTransaction(SessionTask, Transaction.Status).protected voidcloseTransactionSafely(SessionTask sessionTask, Transaction.Status status)Deprecated.Tries to close the transaction but will catch exceptions and log them.protected voidcloseTransactionSafely(Transaction.Status status)Deprecated.Tries to close the transaction but will catch exceptions and log them.protected static Optional<Throwable>determineIfSpecialException(Throwable ex)Deprecated.Check if any exception in the chain isTemporaryExceptionorFailurethen respond with the right error code so that the client knows to retry.protected Optional<Iterator<?>>fromBytecode(SessionTask sessionTask, Bytecode bytecode)Deprecated.protected Iterator<?>fromScript(SessionTask sessionTask, String script)Deprecated.Constructs anIteratorfrom the results of a script evaluation provided in theSessionTask.protected Map<String,Object>generateResponseMetaData(SessionTask sessionTask, ResponseStatusCode code, Iterator<?> itty)Deprecated.Generates response result meta-data to put on aResponseMessage.protected Map<String,Object>generateStatusAttributes(SessionTask sessionTask, ResponseStatusCode code, Iterator<?> itty)Deprecated.Generates response status meta-data to put on aResponseMessage.longgetActualTimeoutLengthWhenClosed()Deprecated.Optional<AbstractSession.CloseReason>getCloseReason()Deprecated.GremlinScriptEnginegetScriptEngine(SessionTask sessionTask, String language)Deprecated.Gets the script engine from the cached one in theGremlinExecutor.StringgetSessionId()Deprecated.Gets the identifier for the session.protected BindingsgetWorkerBindings()Deprecated.protected voidhandleException(SessionTask sessionTask, Throwable t)Deprecated.protected voidhandleGraphOperation(SessionTask sessionTask, Bytecode bytecode, Graph graph)Deprecated.protected voidhandleIterator(SessionTask sessionTask, Iterator<?> itty)Deprecated.Provides a generic way of iterating a result set back to the client.booleanisBoundTo(io.netty.channel.Channel channel)Deprecated.Determines if the suppliedChannelobject is the same as the one bound to theSession.booleanisTransactionManaged()Deprecated.protected voiditerateComplete(SessionTask sessionTask, Iterator<?> itty)Deprecated.Called when iteration withinhandleIterator(SessionTask, Iterator)is on its final pass and the final frame is about to be sent back to the client.protected FramemakeFrame(SessionTask sessionTask, List<Object> aggregate, ResponseStatusCode code, Iterator<?> itty)Deprecated.protected BindingsmergeBindingsFromRequest(SessionTask sessionTask, Bindings bindings)Deprecated.protected voidprocess(SessionTask sessionTask)Deprecated.protected abstract voidsendTimeoutResponseForUncommencedTask()Deprecated.Respond to the client with the specific timeout response for this Session implementation.voidsetSessionCancelFuture(ScheduledFuture<?> f)Deprecated.Sets a reference to the job that will cancel this session if it exceeds its timeout period.voidsetSessionFuture(Future<?> f)Deprecated.Sets a reference to the job itself that is running this session.protected voidstartTransaction(SessionTask sessionTask)Deprecated.Called right before a transaction starts withinRunnable.run().voidtriggerTimeout(long timeout, boolean causedBySession)Deprecated.Provides a general way to interrupt the session by way of a timeout.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.tinkerpop.gremlin.server.handler.SessionisAcceptingTasks, submitTask
 
- 
 
- 
- 
- 
Field Detail- 
sessionThreadprotected Thread sessionThread Deprecated.The session thread is a reference to the thread that is running the session and should be set by an implementation as the first line of theRunnable.run()method.
 - 
maintainStateAfterExceptionprotected final boolean maintainStateAfterException Deprecated.
 - 
closeReasonprotected final AtomicReference<AbstractSession.CloseReason> closeReason Deprecated.
 - 
graphManagerprotected final GraphManager graphManager Deprecated.
 - 
sessionsprotected final ConcurrentMap<String,Session> sessions Deprecated.
 - 
sessionTaskStartedprotected final AtomicBoolean sessionTaskStarted Deprecated.
 
- 
 - 
Method Detail- 
cancelprotected void cancel(boolean mayInterruptIfRunning) Deprecated.
 - 
isTransactionManagedpublic boolean isTransactionManaged() Deprecated.
 - 
getSessionIdpublic String getSessionId() Deprecated.Description copied from interface:SessionGets the identifier for the session.- Specified by:
- getSessionIdin interface- Session
 
 - 
isBoundTopublic boolean isBoundTo(io.netty.channel.Channel channel) Deprecated.Description copied from interface:SessionDetermines if the suppliedChannelobject is the same as the one bound to theSession.
 - 
getActualTimeoutLengthWhenClosedpublic long getActualTimeoutLengthWhenClosed() Deprecated.
 - 
getCloseReasonpublic Optional<AbstractSession.CloseReason> getCloseReason() Deprecated.
 - 
getScriptEnginepublic GremlinScriptEngine getScriptEngine(SessionTask sessionTask, String language) Deprecated.Gets the script engine from the cached one in theGremlinExecutor.
 - 
sendTimeoutResponseForUncommencedTaskprotected abstract void sendTimeoutResponseForUncommencedTask() Deprecated.Respond to the client with the specific timeout response for this Session implementation. This is for situations where the Session hasn't started running.
 - 
setSessionCancelFuturepublic void setSessionCancelFuture(ScheduledFuture<?> f) Deprecated.Description copied from interface:SessionSets a reference to the job that will cancel this session if it exceeds its timeout period.- Specified by:
- setSessionCancelFuturein interface- Session
 
 - 
setSessionFuturepublic void setSessionFuture(Future<?> f) Deprecated.Description copied from interface:SessionSets a reference to the job itself that is running this session.- Specified by:
- setSessionFuturein interface- Session
 
 - 
triggerTimeoutpublic void triggerTimeout(long timeout, boolean causedBySession)Deprecated.Description copied from interface:SessionProvides a general way to interrupt the session by way of a timeout.- Specified by:
- triggerTimeoutin interface- Session
- Parameters:
- timeout- the length of time that passed for the timeout to have triggered
- causedBySession- determines if the timeout triggered due to a particular request (i.e.- falseor because of the session lifetime (i.e.- true
 
 - 
processprotected void process(SessionTask sessionTask) throws SessionException Deprecated.- Throws:
- SessionException
 
 - 
handleExceptionprotected void handleException(SessionTask sessionTask, Throwable t) throws SessionException Deprecated.- Throws:
- SessionException
 
 - 
determineIfSpecialExceptionprotected static Optional<Throwable> determineIfSpecialException(Throwable ex) Deprecated.Check if any exception in the chain isTemporaryExceptionorFailurethen respond with the right error code so that the client knows to retry.
 - 
closepublic void close() Deprecated.Removes the session from the session list and cancels the future that manages the lifetime of the session.- Specified by:
- closein interface- AutoCloseable
 
 - 
fromScriptprotected Iterator<?> fromScript(SessionTask sessionTask, String script) throws Exception Deprecated.Constructs anIteratorfrom the results of a script evaluation provided in theSessionTask.- Parameters:
- sessionTask- The session task which can be used as a context in constructing the- Iterator
- script- The script extracted by the calling method from the- sessionTask
- Throws:
- Exception
 
 - 
fromBytecodeprotected Optional<Iterator<?>> fromBytecode(SessionTask sessionTask, Bytecode bytecode) throws Exception Deprecated.Constructs anIteratorfromBytecodeprovided in theSessionTask. If theBytecodeis found to evalute to aGraphOpthen it is processed and an emptyOptionalis returned.
 - 
getWorkerBindingsprotected Bindings getWorkerBindings() throws SessionException Deprecated.- Throws:
- SessionException
 
 - 
mergeBindingsFromRequestprotected Bindings mergeBindingsFromRequest(SessionTask sessionTask, Bindings bindings) throws SessionException Deprecated.- Throws:
- SessionException
 
 - 
handleIteratorprotected void handleIterator(SessionTask sessionTask, Iterator<?> itty) throws InterruptedException Deprecated.Provides a generic way of iterating a result set back to the client.- Parameters:
- sessionTask- The Gremlin Server- SessionTaskobject containing settings, request message, etc.
- itty- The result to iterator
- Throws:
- InterruptedException
 
 - 
handleGraphOperationprotected void handleGraphOperation(SessionTask sessionTask, Bytecode bytecode, Graph graph) throws Exception Deprecated.- Throws:
- Exception
 
 - 
iterateCompleteprotected void iterateComplete(SessionTask sessionTask, Iterator<?> itty) Deprecated.Called when iteration withinhandleIterator(SessionTask, Iterator)is on its final pass and the final frame is about to be sent back to the client. This method only gets called on successful iteration of the entire result.
 - 
generateStatusAttributesprotected Map<String,Object> generateStatusAttributes(SessionTask sessionTask, ResponseStatusCode code, Iterator<?> itty) Deprecated.Generates response status meta-data to put on aResponseMessage.- Parameters:
- itty- a reference to the current- Iteratorof results - it is not meant to be forwarded in this method
 
 - 
generateResponseMetaDataprotected Map<String,Object> generateResponseMetaData(SessionTask sessionTask, ResponseStatusCode code, Iterator<?> itty) Deprecated.Generates response result meta-data to put on aResponseMessage.- Parameters:
- itty- a reference to the current- Iteratorof results - it is not meant to be forwarded in this method
 
 - 
makeFrameprotected Frame makeFrame(SessionTask sessionTask, List<Object> aggregate, ResponseStatusCode code, Iterator<?> itty) throws Exception Deprecated.- Throws:
- Exception
 
 - 
startTransactionprotected void startTransaction(SessionTask sessionTask) Deprecated.Called right before a transaction starts withinRunnable.run(). The default implementation checks for open transactions and throws an exception if it finds any and generally assumes auto-transactions are enabled on graphs (i.e. transaction automatically start on read/write). Providers who do not follow these sorts of transaction semantics should provide an override to this method.
 - 
closeTransactionprotected void closeTransaction(Transaction.Status status) Deprecated.Close the transaction without aSessionTaskwhich suppliesnullto that argument forcloseTransaction(SessionTask, Transaction.Status). This method is idempotent.
 - 
closeTransactionSafelyprotected void closeTransactionSafely(Transaction.Status status) Deprecated.Tries to close the transaction but will catch exceptions and log them. This method is idempotent.
 - 
closeTransactionSafelyprotected void closeTransactionSafely(SessionTask sessionTask, Transaction.Status status) Deprecated.Tries to close the transaction but will catch exceptions and log them. This method is idempotent.
 - 
closeTransactionprotected void closeTransaction(SessionTask sessionTask, Transaction.Status status) Deprecated.Closes a transaction with commit or rollback. Strict transaction management settings are observed when configured as such inSettings.strictTransactionManagementand when aliases are present on the request in the currentSessionTask. If the suppliedSessionTaskisnullthen "strict" is bypassed so this form must be called with care. Bypassing is often useful to ensure that all transactions are cleaned up when multiple graphs are referenced. Prefer callingcloseTransaction(Transaction.Status)in this case instead. This method is idempotent.
 
- 
 
-