Package org.elasticsearch.http.netty4
Class Netty4HttpPipeliningHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
org.elasticsearch.http.netty4.Netty4HttpPipeliningHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class Netty4HttpPipeliningHandler
extends io.netty.channel.ChannelDuplexHandler
Implements HTTP pipelining ordering, ensuring that responses are completely served in the same order as their corresponding requests.
This handler also throttles write operations and will not pass any writes to the next handler so long as the channel is not writable.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionNetty4HttpPipeliningHandler(int maxEventsHeld, Netty4HttpServerTransport serverTransport, ThreadWatchdog.ActivityTracker activityTracker) Construct a new pipelining handler; this handler should be used downstream of HTTP decoding/aggregation. -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) voidflush(io.netty.channel.ChannelHandlerContext ctx) protected voidhandlePipelinedRequest(io.netty.channel.ChannelHandlerContext ctx, Netty4HttpRequest pipelinedRequest) voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) voidwrite(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, readMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregisteredMethods 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
-
Netty4HttpPipeliningHandler
public Netty4HttpPipeliningHandler(int maxEventsHeld, Netty4HttpServerTransport serverTransport, ThreadWatchdog.ActivityTracker activityTracker) Construct a new pipelining handler; this handler should be used downstream of HTTP decoding/aggregation.- Parameters:
maxEventsHeld- the maximum number of channel events that will be retained prior to aborting the channel connection; this is required as events cannot queue up indefinitely
-
-
Method Details
-
channelRead
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter
-
handlePipelinedRequest
protected void handlePipelinedRequest(io.netty.channel.ChannelHandlerContext ctx, Netty4HttpRequest pipelinedRequest) -
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) - Specified by:
writein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
writein classio.netty.channel.ChannelDuplexHandler
-
channelWritabilityChanged
public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws IOException - Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
flushin classio.netty.channel.ChannelDuplexHandler- Throws:
IOException
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
exceptionCaught
- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-