Package com.linkedin.venice.listener
Class RouterRequestHttpHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
-
- com.linkedin.venice.listener.RouterRequestHttpHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
public class RouterRequestHttpHandler extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
Monitors the stream, when it gets enough bytes that form a genuine object, it deserializes the object and passes it along the stack.SimpleChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
will release the incoming request object:FullHttpRequest
for each request. The downstream handler is not expected to use this object any more.
-
-
Constructor Summary
Constructors Constructor Description RouterRequestHttpHandler(StatsHandler handler, java.util.Map<java.lang.String,java.lang.Integer> storeToEarlyTerminationThresholdMSMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req)
void
channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
void
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)
void
userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt)
This function is used to support http keep-alive.-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRegistered, channelUnregistered, channelWritabilityChanged
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Constructor Detail
-
RouterRequestHttpHandler
public RouterRequestHttpHandler(StatsHandler handler, java.util.Map<java.lang.String,java.lang.Integer> storeToEarlyTerminationThresholdMSMap)
-
-
Method Detail
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
channelReadComplete
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelReadComplete
in classio.netty.channel.ChannelInboundHandlerAdapter
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req) throws java.lang.Exception
- Specified by:
channelRead0
in classio.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpRequest>
- Throws:
java.lang.Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt) throws java.lang.Exception
This function is used to support http keep-alive. For now, the connection will keep open if the idle time is less than the configured threshold, we might need to consider to close it after a long period of time, such as 12 hours.- Specified by:
userEventTriggered
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
userEventTriggered
in classio.netty.channel.ChannelInboundHandlerAdapter
- Parameters:
ctx
-evt
-- Throws:
java.lang.Exception
-
-