Class NettyOptionSettingChannelInitializer
java.lang.Object
io.netty5.channel.ChannelInitializer<io.netty5.channel.Channel>
eu.cloudnetservice.driver.impl.network.netty.NettyOptionSettingChannelInitializer
- All Implemented Interfaces:
io.netty5.channel.ChannelHandler
- Direct Known Subclasses:
NettyNetworkClientInitializer, NettyNetworkServerInitializer
public class NettyOptionSettingChannelInitializer
extends io.netty5.channel.ChannelInitializer<io.netty5.channel.Channel>
A custom channel initializer implementation which activates option in the given channel during the initialization if
they are supported by the implementation.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoInitChannel(@NonNull io.netty5.channel.Channel channel) Method that gets called when the actual channel initialization finished and all requested channel options were activated in the channel.protected voidinitChannel(@NonNull io.netty5.channel.Channel channel) Adds an option which should be activated in channels initialized by this initializer if it is supported.Methods inherited from class io.netty5.channel.ChannelInitializer
channelExceptionCaught, handlerAdded, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelInactive, channelInboundEvent, channelRead, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerRemoved, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
-
Field Details
-
options
-
-
Constructor Details
-
NettyOptionSettingChannelInitializer
public NettyOptionSettingChannelInitializer()
-
-
Method Details
-
initChannel
-
option
@NonNull public <T> @NonNull NettyOptionSettingChannelInitializer option(@NonNull @NonNull io.netty5.channel.ChannelOption<T> option, @NonNull T value) Adds an option which should be activated in channels initialized by this initializer if it is supported.- Type Parameters:
T- the type of the option value.- Parameters:
option- the option to activate if supported.value- the value of the option.- Returns:
- this initializer instance, for chaining.
- Throws:
NullPointerException- if the given option or value is null.
-
doInitChannel
Method that gets called when the actual channel initialization finished and all requested channel options were activated in the channel. This channel removes the need for overriding classes to callsuper.initChannelin order to get all channel options activated.- Parameters:
channel- the channel to initialize.- Throws:
Exception- thrown if an error occurs during initialization.
-