Class HttpStreamingResponseHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
For GraphBinary responses, content chunks are passed to a ByteBufQueueInputStream consumed by a
GraphBinaryStreamResponseReader on a separate thread. That reader deserializes results incrementally,
delivers them to the ResultSet, and handles completion and cleanup. For non-GraphBinary error responses
(e.g., JSON 401/500), the error body is accumulated and parsed when the response ends, then
LAST_CONTENT_READ_RESPONSE is fired for GremlinResponseHandler to process.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionHttpStreamingResponseHandler(GraphBinaryReader graphBinaryReader, AtomicReference<ResultSet> pendingResultSet, ExecutorService readerPool) HttpStreamingResponseHandler(GraphBinaryReader graphBinaryReader, AtomicReference<ResultSet> pendingResultSet, ExecutorService readerPool, long readTimeoutMillis) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voiddecode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject msg, List<Object> out) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) Methods inherited from class io.netty.handler.codec.MessageToMessageDecoder
acceptInboundMessage, channelRead, channelReadCompleteMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
HttpStreamingResponseHandler
public HttpStreamingResponseHandler(GraphBinaryReader graphBinaryReader, AtomicReference<ResultSet> pendingResultSet, ExecutorService readerPool) -
HttpStreamingResponseHandler
public HttpStreamingResponseHandler(GraphBinaryReader graphBinaryReader, AtomicReference<ResultSet> pendingResultSet, ExecutorService readerPool, long readTimeoutMillis) - Parameters:
readTimeoutMillis- the connection'sreadTimeout. When positive, the reader thread's own timeout is armed as a backstop 5000Lms longer, so the pipelineReadTimeoutHandlerfires first on a stalled connection and terminates the response with a properly typed exception. A value<= 0(the default, meaning "no timeout") leaves the reader blocking indefinitely.The translation to the backstop bound lives here rather than in
ByteBufQueueInputStream's constructor so that the stream can be constructed with the effective bound directly (small values in tests, without paying the full grace).
-
-
Method Details
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject msg, List<Object> out) throws Exception - Specified by:
decodein classio.netty.handler.codec.MessageToMessageDecoder<io.netty.handler.codec.http.HttpObject>- Throws:
Exception
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-