public class SessionOpProcessor extends AbstractEvalOpProcessor
OpProcessor
implementation that handles ScriptEngine
script evaluation in the context of
a session. Note that this processor will also take a "close" op to kill the session and rollback any incomplete transactions.AbstractEvalOpProcessor.BindingSupplier
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_GLOBAL_FUNCTION_CACHE_ENABLED
Configuration setting that behaves as an override to the global script engine setting of the same name that is
provided to the
GroovyCompilerGremlinPlugin . |
static String |
CONFIG_PER_GRAPH_CLOSE_TIMEOUT
Configuration setting for how long to wait in milliseconds for each configured graph to close any open
transactions when the session is killed.
|
static String |
CONFIG_SESSION_TIMEOUT
Configuration setting for how long a session will be available before it times out.
|
static long |
DEFAULT_PER_GRAPH_CLOSE_TIMEOUT
Default amount of time to wait in milliseconds for each configured graph to close any open transactions when
the session is killed.
|
static long |
DEFAULT_SESSION_TIMEOUT
Default timeout for a session is eight hours.
|
static String |
OP_PROCESSOR_NAME |
protected static ConcurrentHashMap<String,Session> |
sessions
Script engines are evaluated in a per session context where imports/scripts are isolated per session.
|
CONFIG_MAX_PARAMETERS, DEFAULT_MAX_PARAMETERS, evalOpTimer, INVALID_BINDINGS_KEYS, maxParameters
manageTransactions
Constructor and Description |
---|
SessionOpProcessor() |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeProcessing(Graph graph,
Context ctx) |
void |
close() |
protected void |
evalOp(Context context) |
protected Function<Context,AbstractEvalOpProcessor.BindingSupplier> |
getBindingMaker(Session session)
A useful method for those extending this class, where the means for binding construction can be supplied
to this class.
|
ThrowingConsumer<Context> |
getEvalOp()
Provides an operation for evaluating a Gremlin script.
|
String |
getName()
The name of the processor which requests must refer to "processor" field on a request.
|
protected static Session |
getSession(Context context,
RequestMessage msg)
Examines the
RequestMessage and extracts the session token. |
protected void |
handleGraphOperation(Bytecode bytecode,
Graph graph,
Context context)
If
Bytecode is detected to contain a "graph operation" then it gets processed by this method. |
protected void |
handleIterator(Context context,
Iterator itty,
Graph graph) |
void |
init(Settings settings)
Initialize the
OpProcessor with settings from the server. |
protected void |
onError(Graph graph,
Context ctx) |
protected void |
onTraversalSuccess(Graph graph,
Context ctx) |
Optional<ThrowingConsumer<Context>> |
selectOther(Context ctx)
Older versions of session-based requests accepted a "close" operator in addition to "eval".
|
protected Optional<ThrowingConsumer<Context>> |
validateEvalMessage(RequestMessage message) |
evalOpInternal, select
attemptCommit, attemptRollback, determineIfSpecialException, generateResultMetaData, generateStatusAttributes, handleIterator, isForceFlushed, iterateComplete, makeFrame
public static final String OP_PROCESSOR_NAME
protected static ConcurrentHashMap<String,Session> sessions
public static final String CONFIG_SESSION_TIMEOUT
public static final String CONFIG_PER_GRAPH_CLOSE_TIMEOUT
public static final String CONFIG_GLOBAL_FUNCTION_CACHE_ENABLED
GroovyCompilerGremlinPlugin
.public static final long DEFAULT_SESSION_TIMEOUT
public static final long DEFAULT_PER_GRAPH_CLOSE_TIMEOUT
public String getName()
OpProcessor
public void init(Settings settings)
OpProcessor
OpProcessor
with settings from the server. This method should only be called once at
server startup by a single thread.public Optional<ThrowingConsumer<Context>> selectOther(Context ctx) throws OpProcessorException
selectOther
in class AbstractEvalOpProcessor
OpProcessorException
public ThrowingConsumer<Context> getEvalOp()
AbstractEvalOpProcessor
getEvalOp
in class AbstractEvalOpProcessor
protected Optional<ThrowingConsumer<Context>> validateEvalMessage(RequestMessage message) throws OpProcessorException
validateEvalMessage
in class AbstractEvalOpProcessor
OpProcessorException
protected void evalOp(Context context) throws OpProcessorException
OpProcessorException
protected static Session getSession(Context context, RequestMessage msg)
RequestMessage
and extracts the session token. The session is then either found or a new
one is created.protected Function<Context,AbstractEvalOpProcessor.BindingSupplier> getBindingMaker(Session session)
evalOp(Context)
to create the final argument to
AbstractEvalOpProcessor.evalOpInternal(Context, Supplier, BindingSupplier)
.
In this way an extending class can use the default AbstractEvalOpProcessor.BindingSupplier
which carries a lot of re-usable functionality or provide a new one to override the existing approach.protected void handleGraphOperation(Bytecode bytecode, Graph graph, Context context)
Bytecode
is detected to contain a "graph operation" then it gets processed by this method.protected void handleIterator(Context context, Iterator itty, Graph graph) throws InterruptedException
InterruptedException
Copyright © 2013–2022 Apache Software Foundation. All rights reserved.