public abstract class AbstractOpProcessor extends Object implements OpProcessor
OpProcessor
implementation that processes an Iterator
of results in a generalized way while
ensuring that graph transactions are properly managed.Modifier and Type | Field and Description |
---|---|
protected boolean |
manageTransactions
When set to
true , transactions are always managed otherwise they can be overridden by the request. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractOpProcessor(boolean manageTransactions) |
Modifier and Type | Method and Description |
---|---|
protected static void |
attemptCommit(RequestMessage msg,
GraphManager graphManager,
boolean strict) |
protected static void |
attemptRollback(RequestMessage msg,
GraphManager graphManager,
boolean strict) |
protected static Optional<Throwable> |
determineIfSpecialException(Throwable ex)
Check if any exception in the chain is
TemporaryException or Failure then respond with the
right error code so that the client knows to retry. |
protected Map<String,Object> |
generateResultMetaData(io.netty.channel.ChannelHandlerContext ctx,
RequestMessage msg,
ResponseStatusCode code,
Iterator itty,
Settings settings)
Generates response result meta-data to put on a
ResponseMessage . |
protected Map<String,Object> |
generateStatusAttributes(io.netty.channel.ChannelHandlerContext ctx,
RequestMessage msg,
ResponseStatusCode code,
Iterator itty,
Settings settings)
Generates response status meta-data to put on a
ResponseMessage . |
protected void |
handleIterator(Context context,
Iterator itty)
Provides a generic way of iterating a result set back to the client.
|
protected boolean |
isForceFlushed(io.netty.channel.ChannelHandlerContext ctx,
RequestMessage msg,
Iterator itty)
Determines if a
Frame should be force flushed outside of the resultIterationBatchSize and the
termination of the iterator. |
protected void |
iterateComplete(io.netty.channel.ChannelHandlerContext ctx,
RequestMessage msg,
Iterator itty)
Called when iteration within
handleIterator(Context, Iterator) is on its final pass and the final
frame is about to be sent back to the client. |
protected static Frame |
makeFrame(Context ctx,
RequestMessage msg,
MessageSerializer<?> serializer,
boolean useBinary,
List<Object> aggregate,
ResponseStatusCode code,
Map<String,Object> responseMetaData,
Map<String,Object> statusAttributes) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, init, select
close
protected final boolean manageTransactions
true
, transactions are always managed otherwise they can be overridden by the request.protected static Optional<Throwable> determineIfSpecialException(Throwable ex)
TemporaryException
or Failure
then respond with the
right error code so that the client knows to retry.protected void handleIterator(Context context, Iterator itty) throws InterruptedException
context
- The Gremlin Server Context
object containing settings, request message, etc.itty
- The result to iteratorInterruptedException
protected void iterateComplete(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)
handleIterator(Context, 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.protected boolean isForceFlushed(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)
Frame
should be force flushed outside of the resultIterationBatchSize
and the
termination of the iterator. By default this method return false
.itty
- a reference to the current Iterator
of results - it is not meant to be forwarded in
this methodprotected Map<String,Object> generateResultMetaData(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, ResponseStatusCode code, Iterator itty, Settings settings)
ResponseMessage
.itty
- a reference to the current Iterator
of results - it is not meant to be forwarded in
this methodprotected Map<String,Object> generateStatusAttributes(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, ResponseStatusCode code, Iterator itty, Settings settings)
ResponseMessage
.itty
- a reference to the current Iterator
of results - it is not meant to be forwarded in
this methodprotected static Frame makeFrame(Context ctx, RequestMessage msg, MessageSerializer<?> serializer, boolean useBinary, List<Object> aggregate, ResponseStatusCode code, Map<String,Object> responseMetaData, Map<String,Object> statusAttributes) throws Exception
Exception
protected static void attemptCommit(RequestMessage msg, GraphManager graphManager, boolean strict)
protected static void attemptRollback(RequestMessage msg, GraphManager graphManager, boolean strict)
Copyright © 2013–2022 Apache Software Foundation. All rights reserved.