Class AbstractOpProcessor
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor
 
- 
- All Implemented Interfaces:
- AutoCloseable,- OpProcessor
 - Direct Known Subclasses:
- AbstractEvalOpProcessor,- TraversalOpProcessor
 
 public abstract class AbstractOpProcessor extends Object implements OpProcessor A baseOpProcessorimplementation that processes anIteratorof results in a generalized way while ensuring that graph transactions are properly managed.- Author:
- Stephen Mallette (http://stephen.genoprime.com)
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected booleanmanageTransactionsWhen set totrue, transactions are always managed otherwise they can be overridden by the request.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractOpProcessor(boolean manageTransactions)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidattemptCommit(RequestMessage msg, GraphManager graphManager, boolean strict)protected static voidattemptRollback(RequestMessage msg, GraphManager graphManager, boolean strict)protected static Optional<Throwable>determineIfSpecialException(Throwable ex)Check if any exception in the chain isTemporaryExceptionorFailurethen 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 aResponseMessage.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 aResponseMessage.protected voidhandleIterator(Context context, Iterator itty)Provides a generic way of iterating a result set back to the client.protected booleanisForceFlushed(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)Determines if aFrameshould be force flushed outside of theresultIterationBatchSizeand the termination of the iterator.protected voiditerateComplete(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)Called when iteration withinhandleIterator(Context, Iterator)is on its final pass and the final frame is about to be sent back to the client.protected static FramemakeFrame(Context ctx, RequestMessage msg, MessageSerializer<?> serializer, boolean useBinary, List<Object> aggregate, ResponseStatusCode code, Map<String,Object> responseMetaData, Map<String,Object> statusAttributes)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface java.lang.AutoCloseableclose
 - 
Methods inherited from interface org.apache.tinkerpop.gremlin.server.OpProcessorgetName, init, select
 
- 
 
- 
- 
- 
Method Detail- 
determineIfSpecialExceptionprotected static Optional<Throwable> determineIfSpecialException(Throwable ex) Check if any exception in the chain isTemporaryExceptionorFailurethen respond with the right error code so that the client knows to retry.
 - 
handleIteratorprotected void handleIterator(Context context, Iterator itty) throws InterruptedException Provides a generic way of iterating a result set back to the client.- Parameters:
- context- The Gremlin Server- Contextobject containing settings, request message, etc.
- itty- The result to iterator
- Throws:
- InterruptedException
 
 - 
iterateCompleteprotected void iterateComplete(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)Called when iteration withinhandleIterator(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.
 - 
isForceFlushedprotected boolean isForceFlushed(io.netty.channel.ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)Determines if aFrameshould be force flushed outside of theresultIterationBatchSizeand the termination of the iterator. By default this method returnfalse.- Parameters:
- itty- a reference to the current- Iteratorof results - it is not meant to be forwarded in this method
 
 - 
generateResultMetaDataprotected 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 aResponseMessage.- Parameters:
- itty- a reference to the current- Iteratorof results - it is not meant to be forwarded in this method
 
 - 
generateStatusAttributesprotected 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 aResponseMessage.- Parameters:
- itty- a reference to the current- Iteratorof results - it is not meant to be forwarded in this method
 
 - 
makeFrameprotected 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 - Throws:
- Exception
 
 - 
attemptCommitprotected static void attemptCommit(RequestMessage msg, GraphManager graphManager, boolean strict) 
 - 
attemptRollbackprotected static void attemptRollback(RequestMessage msg, GraphManager graphManager, boolean strict) 
 
- 
 
-