Class IdleConnectionHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
org.apache.tinkerpop.gremlin.driver.handler.IdleConnectionHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class IdleConnectionHandler
extends io.netty.channel.ChannelDuplexHandler
Detects
IdleStateEvents and closes the channel with the goal of releasing pooled connections that have not
been used in a while. An idle event that fires while a request is in flight is ignored so that idleTimeout
only reaps connections that are idle in the pool between requests; bounding a stalled in-flight response is the
responsibility of the per-request readTimeout (ReadTimeoutHandler). This keeps the two timeouts from
overlapping on the in-flight window.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.util.AttributeKey<io.netty.handler.timeout.IdleStateEvent> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) Detects if anIdleStateEventhas occurred and closes the channel, unless a request is currently in flight, in which case the event is ignored and the channel is left to the per-request read timeout.Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read, writeMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtMethods 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
-
Field Details
-
IDLE_STATE_EVENT
public static final io.netty.util.AttributeKey<io.netty.handler.timeout.IdleStateEvent> IDLE_STATE_EVENT
-
-
Constructor Details
-
IdleConnectionHandler
-
-
Method Details
-
userEventTriggered
Detects if anIdleStateEventhas occurred and closes the channel, unless a request is currently in flight, in which case the event is ignored and the channel is left to the per-request read timeout.- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter
-