Class NettyNetworkHandler
java.lang.Object
io.netty5.channel.SimpleChannelInboundHandler<BasePacket>
eu.cloudnetservice.driver.network.netty.NettyNetworkHandler
- All Implemented Interfaces:
io.netty5.channel.ChannelHandler
- Direct Known Subclasses:
NettyNetworkClientHandler,NettyNetworkServerHandler
@Internal
public abstract class NettyNetworkHandler
extends io.netty5.channel.SimpleChannelInboundHandler<BasePacket>
The default netty inbound handler used to call downstream packet listeners when receiving a packet.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NettyNetworkChannelprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelExceptionCaught(@NonNull io.netty5.channel.ChannelHandlerContext ctx, @NonNull Throwable cause) voidchannelInactive(@NonNull io.netty5.channel.ChannelHandlerContext ctx) voidchannelReadComplete(@NonNull io.netty5.channel.ChannelHandlerContext ctx) protected abstract @NonNull Collection<NetworkChannel> channels()Get all channels which are connected to the underlying network component.protected voiddoHandlePacket(@NonNull BasePacket packet) Handles the incoming packet and posts it either to the associated waiting query handler or directly into the packet registry, calling all associated handlers.protected voidmessageReceived(@NonNull io.netty5.channel.ChannelHandlerContext ctx, @NonNull BasePacket msg) Get the packet dispatcher used to dispatch incoming packets.Methods inherited from class io.netty5.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods 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, channelActive, channelInboundEvent, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, isSharable, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
channel
-
-
Constructor Details
-
NettyNetworkHandler
public NettyNetworkHandler()
-
-
Method Details
-
channelInactive
-
channelExceptionCaught
-
channelReadComplete
-
messageReceived
protected void messageReceived(@NonNull @NonNull io.netty5.channel.ChannelHandlerContext ctx, @NonNull @NonNull BasePacket msg) - Specified by:
messageReceivedin classio.netty5.channel.SimpleChannelInboundHandler<BasePacket>
-
doHandlePacket
Handles the incoming packet and posts it either to the associated waiting query handler or directly into the packet registry, calling all associated handlers.- Parameters:
packet- the packet to handle.- Throws:
NullPointerException- if the given packet is null.
-
channels
Get all channels which are connected to the underlying network component.- Returns:
- all connected channels.
-
packetDispatcher
-