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 -
Constructor Summary
ConstructorsConstructorDescriptionNettyIdleStateHandler(int timeoutSeconds) Constructs a new netty idle state handler instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidchannelIdle(@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, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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