Top Description Inners Fields Constructors Methods
io.netty.bootstrap

public Class ServerBootstrap

extends AbstractBootstrap<ServerBootstrap, ServerChannel>
Class Inheritance
Imports
io.netty.channel.Channel, .ChannelConfig, .ChannelFuture, .ChannelFutureListener, .ChannelHandler, .ChannelHandlerContext, .ChannelInboundHandlerAdapter, .ChannelInitializer, .ChannelOption, .ChannelPipeline, .EventLoopGroup, .ServerChannel, io.netty.util.AttributeKey, io.netty.util.internal.ObjectUtil, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.Collection, .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
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.netty.bootstrap.AbstractBootstrap:
group

Constructor Summary

AccessConstructor and Description
public
private

Method Summary

Modifier and TypeMethod and Description
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.netty.bootstrap.AbstractBootstrap.clone.

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

Implements abstract io.netty.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.netty.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 void
public ServerBootstrap
validate()

Overrides io.netty.bootstrap.AbstractBootstrap.validate.

Validate all the parameters.
Inherited from io.netty.bootstrap.AbstractBootstrap:
attrattrsattrs0bindbindbindbindbindchannelchannelFactorychannelFactorychannelFactorycopiedMapextensionsClassLoadergetInitializerExtensionsgrouphandlerhandlerinitAndRegisterlocalAddresslocalAddresslocalAddresslocalAddresslocalAddressnewAttributesArraynewAttributesArraynewOptionsArraynewOptionsArrayoptionoptionsoptions0registersetAttributessetChannelOptionstoString

Field Detail

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

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.netty.bootstrap.AbstractBootstrap.clone.

Doc from io.netty.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.netty.bootstrap.AbstractBootstrap.config.

Doc from io.netty.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.netty.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 void init(Channel channel)

Implements abstract io.netty.bootstrap.AbstractBootstrap.init.

Annotations
@Override
validateback to summary
public ServerBootstrap validate()

Overrides io.netty.bootstrap.AbstractBootstrap.validate.

Doc from io.netty.bootstrap.AbstractBootstrap.validate.

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

Annotations
@Override
io.netty.bootstrap back to summary

private Class ServerBootstrap.ServerBootstrapAcceptor

extends ChannelInboundHandlerAdapter
Class Inheritance

Field Summary

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

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
public void
public void
private static void
Inherited from io.netty.channel.ChannelInboundHandlerAdapter:
channelActivechannelInactivechannelReadCompletechannelRegisteredchannelUnregisteredchannelWritabilityChangeduserEventTriggered

Field Detail

childAttrsback to summary
private final Map.Entry<AttributeKey<?>, Object>[] childAttrs
childGroupback to summary
private final EventLoopGroup childGroup
childHandlerback to summary
private final ChannelHandler childHandler
childOptionsback to summary
private final Map.Entry<ChannelOption<?>, Object>[] childOptions
enableAutoReadTaskback to summary
private final Runnable enableAutoReadTask
extensionsback to summary
private final Collection<ChannelInitializerExtension> extensions

Constructor Detail

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

Method Detail

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

Overrides io.netty.channel.ChannelInboundHandlerAdapter.channelRead.

Implements io.netty.channel.ChannelInboundHandler.channelRead.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelRead.

Calls ChannelHandlerContext#fireChannelRead(Object) to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
@SuppressWarnings:unchecked
exceptionCaughtback to summary
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught.

Implements io.netty.channel.ChannelInboundHandler.exceptionCaught, io.netty.channel.ChannelHandler.exceptionCaught.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught.

Calls ChannelHandlerContext#fireExceptionCaught(Throwable) to forward to the next ChannelHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

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