Class IdleConnectionHandler

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

    @Sharable
    public class IdleConnectionHandler
    extends io.netty.channel.ChannelDuplexHandler
    Detects IdleStateEvents and closes the channel with the goal of releasing resources that haven't been used in a while.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static io.netty.util.AttributeKey<io.netty.handler.timeout.IdleStateEvent> IDLE_STATE_EVENT  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void userEventTriggered​(io.netty.channel.ChannelHandlerContext ctx, Object evt)
      Detects if an IdleStateEvent has occurred and closes the channel.
      • Methods inherited from class io.netty.channel.ChannelDuplexHandler

        bind, close, connect, deregister, disconnect, flush, read, write
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from interface io.netty.channel.ChannelHandler

        handlerAdded, handlerRemoved
    • Field Detail

      • IDLE_STATE_EVENT

        public static final io.netty.util.AttributeKey<io.netty.handler.timeout.IdleStateEvent> IDLE_STATE_EVENT
    • Constructor Detail

      • IdleConnectionHandler

        public IdleConnectionHandler()
    • Method Detail

      • userEventTriggered

        public void userEventTriggered​(io.netty.channel.ChannelHandlerContext ctx,
                                       Object evt)
        Detects if an IdleStateEvent has occurred and closes the channel.
        Specified by:
        userEventTriggered in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        userEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapter