Class NettyIdleStateHandler

java.lang.Object
io.netty5.handler.timeout.IdleStateHandler
eu.cloudnetservice.driver.network.netty.http.NettyIdleStateHandler
All Implemented Interfaces:
io.netty5.channel.ChannelHandler

final class NettyIdleStateHandler extends io.netty5.handler.timeout.IdleStateHandler
A custom idle state handler which closes a connection after the given seconds of client inactivity while also considering outbound events. When a http handler sends data to the client the connection will not be closed and kept open until the outbound write finished and the data flushed. This is also the main difference from the default ReadTimeoutHandler directly provided by netty.
Since:
4.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NettyIdleStateHandler(int timeoutSeconds)
    Constructs a new netty idle state handler instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    channelIdle(@NonNull io.netty5.channel.ChannelHandlerContext ctx, @NonNull io.netty5.handler.timeout.IdleStateEvent evt)

    Methods inherited from class io.netty5.handler.timeout.IdleStateHandler

    channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, getAllIdleTimeInMillis, getReaderIdleTimeInMillis, getWriterIdleTimeInMillis, handlerAdded, handlerRemoved, newIdleStateEvent, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty5.channel.ChannelHandler

    bind, channelExceptionCaught, channelInboundEvent, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, isSharable, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown
  • Field Details

    • closed

      private boolean closed
  • Constructor Details

    • NettyIdleStateHandler

      public NettyIdleStateHandler(int timeoutSeconds)
      Constructs a new netty idle state handler instance.
      Parameters:
      timeoutSeconds - the seconds a client is allowed to idle before a forced disconnect.
  • Method Details

    • channelIdle

      protected void channelIdle(@NonNull @NonNull io.netty5.channel.ChannelHandlerContext ctx, @NonNull @NonNull io.netty5.handler.timeout.IdleStateEvent evt)
      Overrides:
      channelIdle in class io.netty5.handler.timeout.IdleStateHandler