Top Description Inners Fields Constructors Methods
io.netty5.bootstrap

public Class ServerBootstrap

extends AbstractBootstrap<ServerBootstrap, ServerChannel, ServerChannelFactory<? extends ServerChannel>>
Class Inheritance
Imports
io.netty5.channel.Channel, .ChannelHandler, .ChannelHandlerContext, .ChannelInitializer, .ChannelOption, .ChannelPipeline, .EventLoop, .EventLoopGroup, .ReflectiveServerChannelFactory, .ServerChannel, .ServerChannelFactory, io.netty5.util.AttributeKey, io.netty5.util.concurrent.Future, .Promise, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.LinkedHashMap, .Map, .Map.Entry, java.util.concurrent.ConcurrentHashMap, .TimeUnit

Bootstrap sub-class which allows easy bootstrap of ServerChannel

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
pack-priv volatile ServerChannelFactory<? extends ServerChannel>
private final Map<AttributeKey<?>, Object>
private volatile EventLoopGroup
private volatile ChannelHandler
private final Map<ChannelOption<?>, Object>
private final ServerBootstrapConfig
private static final InternalLogger
Inherited from io.netty5.bootstrap.AbstractBootstrap:
group

Constructor Summary

AccessConstructor and Description
public
private

Method Summary

Modifier and TypeMethod and Description
public ServerBootstrap
channel(Class<? extends ServerChannel> channelClass)

The Class which is used to create ServerChannel instances from.

public ServerBootstrap
channelFactory(ServerChannelFactory<? extends ServerChannel> channelFactory)

ServerChannelFactory which is used to create Channel instances from when calling bind().

public <T> ServerBootstrap
childAttr(AttributeKey<T> childKey, T value)

Set the specific AttributeKey with the given value on every child Channel.

pack-priv final Map<AttributeKey<?>, Object>
public EventLoopGroup
childGroup()

Deprecated Use config() instead.
Return the configured EventLoopGroup which will be used for the child channels or null if non is configured yet.
public ServerBootstrap
childHandler(ChannelHandler childHandler)

Set the ChannelHandler which is used to serve the request for the Channel's.

pack-priv final ChannelHandler
public <T> ServerBootstrap
childOption(ChannelOption<T> childOption, T value)

Allow to specify a ChannelOption which is used for the Channel instances once they get created (after the acceptor accepted the Channel).

pack-priv final Map<ChannelOption<?>, Object>
public ServerBootstrap
clone()

Implements abstract io.netty5.bootstrap.AbstractBootstrap.clone.

Returns a deep clone of this bootstrap which has the identical configuration.
public final ServerBootstrapConfig
config()

Implements abstract io.netty5.bootstrap.AbstractBootstrap.config.

Returns the AbstractBootstrapConfig object that can be used to obtain the current config of the bootstrap.
public ServerBootstrap
group(EventLoopGroup group)

Overrides io.netty5.bootstrap.AbstractBootstrap.group.

Specify the EventLoopGroup which is used for the parent (acceptor) and the child (client).
public ServerBootstrap
group(EventLoopGroup parentGroup, EventLoopGroup childGroup)

Set the EventLoopGroup for the parent (acceptor) and the child (client).

pack-priv Future<Channel>
pack-priv ServerChannel
public ServerBootstrap
validate()

Overrides io.netty5.bootstrap.AbstractBootstrap.validate.

Validate all the parameters.
Inherited from io.netty5.bootstrap.AbstractBootstrap:
attrattrsbindbindbindbindbindcopiedMapcreateUnregisteredgrouphandlerhandlerinitAndRegisterinitWithoutRegisterlocalAddresslocalAddresslocalAddresslocalAddresslocalAddressnewAttributesArraynewAttributesArraynewOptionsArraynewOptionsArrayoptionoptionsregistersetAttributessetChannelOptionstoString

Field Detail

channelFactoryback to summary
pack-priv volatile ServerChannelFactory<? extends ServerChannel> channelFactory
childAttrsback to summary
private final Map<AttributeKey<?>, Object> childAttrs
childGroupback to summary
private volatile EventLoopGroup childGroup
childHandlerback to summary
private volatile ChannelHandler childHandler
childOptionsback to summary
private final Map<ChannelOption<?>, Object> childOptions
configback to summary
private final ServerBootstrapConfig config
loggerback to summary
private static final InternalLogger logger

Constructor Detail

ServerBootstrapback to summary
public ServerBootstrap()
ServerBootstrapback to summary
private ServerBootstrap(ServerBootstrap bootstrap)

Method Detail

channelback to summary
public ServerBootstrap channel(Class<? extends ServerChannel> channelClass)

The Class which is used to create ServerChannel instances from. You either use this or channelFactory(ServerChannelFactory) if your Channel implementation has no no-args constructor.

channelFactoryback to summary
public ServerBootstrap channelFactory(ServerChannelFactory<? extends ServerChannel> channelFactory)

ServerChannelFactory which is used to create Channel instances from when calling bind(). This method is usually only used if channel(Class) is not working for you because of some more complex needs. If your Channel implementation has a no-args constructor, its highly recommend to just use channel(Class) to simplify your code.

childAttrback to summary
public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value)

Set the specific AttributeKey with the given value on every child Channel. If the value is null the AttributeKey is removed

childAttrsback to summary
pack-priv final Map<AttributeKey<?>, Object> childAttrs()
childGroupback to summary
public EventLoopGroup childGroup()

Deprecated

Use config() instead.

Return the configured EventLoopGroup which will be used for the child channels or null if non is configured yet.

Annotations
@Deprecated
childHandlerback to summary
public ServerBootstrap childHandler(ChannelHandler childHandler)

Set the ChannelHandler which is used to serve the request for the Channel's.

childHandlerback to summary
pack-priv final ChannelHandler childHandler()
childOptionback to summary
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value)

Allow to specify a ChannelOption which is used for the Channel instances once they get created (after the acceptor accepted the Channel). Use a value of null to remove a previous set ChannelOption.

childOptionsback to summary
pack-priv final Map<ChannelOption<?>, Object> childOptions()
cloneback to summary
public ServerBootstrap clone()

Implements abstract io.netty5.bootstrap.AbstractBootstrap.clone.

Doc from io.netty5.bootstrap.AbstractBootstrap.clone.

Returns a deep clone of this bootstrap which has the identical configuration. This method is useful when making multiple Channels with similar settings. Please note that this method does not clone the EventLoopGroup deeply but shallowly, making the group a shared resource.

Returns:ServerBootstrap

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
@SuppressWarnings:CloneDoesntCallSuperClone
configback to summary
public final ServerBootstrapConfig config()

Implements abstract io.netty5.bootstrap.AbstractBootstrap.config.

Doc from io.netty5.bootstrap.AbstractBootstrap.config.

Returns the AbstractBootstrapConfig object that can be used to obtain the current config of the bootstrap.

Annotations
@Override
groupback to summary
public ServerBootstrap group(EventLoopGroup group)

Overrides io.netty5.bootstrap.AbstractBootstrap.group.

Specify the EventLoopGroup which is used for the parent (acceptor) and the child (client).

Annotations
@Override
groupback to summary
public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup)

Set the EventLoopGroup for the parent (acceptor) and the child (client). These EventLoopGroup's are used to handle all the events and IO for ServerChannel and Channel's.

initback to summary
pack-priv Future<Channel> init(Channel channel)

Implements abstract io.netty5.bootstrap.AbstractBootstrap.init.

Annotations
@Override
newChannelback to summary
pack-priv ServerChannel newChannel(EventLoop eventLoop) throws Exception

Implements abstract io.netty5.bootstrap.AbstractBootstrap.newChannel.

Annotations
@Override
validateback to summary
public ServerBootstrap validate()

Overrides io.netty5.bootstrap.AbstractBootstrap.validate.

Doc from io.netty5.bootstrap.AbstractBootstrap.validate.

Validate all the parameters. Sub-classes may override this, but should call the super method in that case.

Annotations
@Override
io.netty5.bootstrap back to summary

private Class ServerBootstrap.ServerBootstrapAcceptor

extends Object
implements ChannelHandler
Class Inheritance
All Implemented Interfaces
io.netty5.channel.ChannelHandler

Field Summary

Modifier and TypeField and Description
private final Map.Entry<AttributeKey<?>, Object>[]
private final ChannelHandler
private final Map.Entry<ChannelOption<?>, Object>[]
private final Runnable

Constructor Summary

AccessConstructor and Description
pack-priv
ServerBootstrapAcceptor(final Channel channel, ChannelHandler childHandler, Map.Entry<ChannelOption<?>, Object>[] childOptions, Map.Entry<AttributeKey<?>, Object>[] childAttrs)

Method Summary

Modifier and TypeMethod and Description
public void
channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause)

Overrides default io.netty5.channel.ChannelHandler.channelExceptionCaught.

Gets called if a Throwable was thrown when handling inbound events.
public void
channelRead(ChannelHandlerContext ctx, Object msg)

Overrides default io.netty5.channel.ChannelHandler.channelRead.

Invoked when the current Channel has read a message from the peer.
private static void
private void
initChild(final Channel child)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

childAttrsback to summary
private final Map.Entry<AttributeKey<?>, Object>[] childAttrs
childHandlerback to summary
private final ChannelHandler childHandler
childOptionsback to summary
private final Map.Entry<ChannelOption<?>, Object>[] childOptions
enableAutoReadTaskback to summary
private final Runnable enableAutoReadTask

Constructor Detail

ServerBootstrapAcceptorback to summary
pack-priv ServerBootstrapAcceptor(final Channel channel, ChannelHandler childHandler, Map.Entry<ChannelOption<?>, Object>[] childOptions, Map.Entry<AttributeKey<?>, Object>[] childAttrs)

Method Detail

channelExceptionCaughtback to summary
public void channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelExceptionCaught.

Doc from io.netty5.channel.ChannelHandler.channelExceptionCaught.

Gets called if a Throwable was thrown when handling inbound events.

Annotations
@Override
channelReadback to summary
public void channelRead(ChannelHandlerContext ctx, Object msg)

Overrides default io.netty5.channel.ChannelHandler.channelRead.

Doc from io.netty5.channel.ChannelHandler.channelRead.

Invoked when the current Channel has read a message from the peer.

Annotations
@Override
forceCloseback to summary
private static void forceClose(Channel child, Throwable t)
initChildback to summary
private void initChild(final Channel child)