Package io.netty.bootstrap
Class ServerBootstrap
- java.lang.Object
-
- io.netty.bootstrap.AbstractBootstrap<ServerBootstrap,ServerChannel>
-
- io.netty.bootstrap.ServerBootstrap
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ServerBootstrap extends AbstractBootstrap<ServerBootstrap,ServerChannel>
Bootstrapsub-class which allows easy bootstrap ofServerChannel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classServerBootstrap.ServerBootstrapAcceptor-
Nested classes/interfaces inherited from class io.netty.bootstrap.AbstractBootstrap
AbstractBootstrap.PendingRegistrationPromise
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<AttributeKey<?>,java.lang.Object>childAttrsprivate EventLoopGroupchildGroupprivate ChannelHandlerchildHandlerprivate java.util.Map<ChannelOption<?>,java.lang.Object>childOptionsprivate ServerBootstrapConfigconfigprivate static InternalLoggerlogger-
Fields inherited from class io.netty.bootstrap.AbstractBootstrap
EMPTY_ATTRIBUTE_ARRAY, EMPTY_OPTION_ARRAY, group
-
-
Constructor Summary
Constructors Modifier Constructor Description ServerBootstrap()privateServerBootstrap(ServerBootstrap bootstrap)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> ServerBootstrapchildAttr(AttributeKey<T> childKey, T value)Set the specificAttributeKeywith the given value on every childChannel.(package private) java.util.Map<AttributeKey<?>,java.lang.Object>childAttrs()EventLoopGroupchildGroup()Deprecated.Useconfig()instead.(package private) ChannelHandlerchildHandler()ServerBootstrapchildHandler(ChannelHandler childHandler)Set theChannelHandlerwhich is used to serve the request for theChannel's.<T> ServerBootstrapchildOption(ChannelOption<T> childOption, T value)Allow to specify aChannelOptionwhich is used for theChannelinstances once they get created (after the acceptor accepted theChannel).(package private) java.util.Map<ChannelOption<?>,java.lang.Object>childOptions()ServerBootstrapclone()Returns a deep clone of this bootstrap which has the identical configuration.ServerBootstrapConfigconfig()Returns theAbstractBootstrapConfigobject that can be used to obtain the current config of the bootstrap.ServerBootstrapgroup(EventLoopGroup group)Specify theEventLoopGroupwhich is used for the parent (acceptor) and the child (client).ServerBootstrapgroup(EventLoopGroup parentGroup, EventLoopGroup childGroup)Set theEventLoopGroupfor the parent (acceptor) and the child (client).(package private) voidinit(Channel channel)ServerBootstrapvalidate()Validate all the parameters.-
Methods inherited from class io.netty.bootstrap.AbstractBootstrap
attr, attrs, attrs0, bind, bind, bind, bind, bind, channel, channelFactory, channelFactory, channelFactory, copiedMap, group, handler, handler, initAndRegister, localAddress, localAddress, localAddress, localAddress, localAddress, newOptionsArray, option, options, options0, register, setAttributes, setChannelOptions, toString
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
childOptions
private final java.util.Map<ChannelOption<?>,java.lang.Object> childOptions
-
childAttrs
private final java.util.Map<AttributeKey<?>,java.lang.Object> childAttrs
-
config
private final ServerBootstrapConfig config
-
childGroup
private volatile EventLoopGroup childGroup
-
childHandler
private volatile ChannelHandler childHandler
-
-
Constructor Detail
-
ServerBootstrap
public ServerBootstrap()
-
ServerBootstrap
private ServerBootstrap(ServerBootstrap bootstrap)
-
-
Method Detail
-
group
public ServerBootstrap group(EventLoopGroup group)
Specify theEventLoopGroupwhich is used for the parent (acceptor) and the child (client).- Overrides:
groupin classAbstractBootstrap<ServerBootstrap,ServerChannel>
-
group
public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup)
Set theEventLoopGroupfor the parent (acceptor) and the child (client). TheseEventLoopGroup's are used to handle all the events and IO forServerChannelandChannel's.
-
childOption
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value)
Allow to specify aChannelOptionwhich is used for theChannelinstances once they get created (after the acceptor accepted theChannel). Use a value ofnullto remove a previous setChannelOption.
-
childAttr
public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value)
Set the specificAttributeKeywith the given value on every childChannel. If the value isnulltheAttributeKeyis removed
-
childHandler
public ServerBootstrap childHandler(ChannelHandler childHandler)
Set theChannelHandlerwhich is used to serve the request for theChannel's.
-
init
void init(Channel channel)
- Specified by:
initin classAbstractBootstrap<ServerBootstrap,ServerChannel>
-
validate
public ServerBootstrap validate()
Description copied from class:AbstractBootstrapValidate all the parameters. Sub-classes may override this, but should call the super method in that case.- Overrides:
validatein classAbstractBootstrap<ServerBootstrap,ServerChannel>
-
clone
public ServerBootstrap clone()
Description copied from class:AbstractBootstrapReturns a deep clone of this bootstrap which has the identical configuration. This method is useful when making multipleChannels with similar settings. Please note that this method does not clone theEventLoopGroupdeeply but shallowly, making the group a shared resource.- Specified by:
clonein classAbstractBootstrap<ServerBootstrap,ServerChannel>
-
childGroup
@Deprecated public EventLoopGroup childGroup()
Deprecated.Useconfig()instead.Return the configuredEventLoopGroupwhich will be used for the child channels ornullif non is configured yet.
-
childHandler
final ChannelHandler childHandler()
-
childOptions
final java.util.Map<ChannelOption<?>,java.lang.Object> childOptions()
-
childAttrs
final java.util.Map<AttributeKey<?>,java.lang.Object> childAttrs()
-
config
public final ServerBootstrapConfig config()
Description copied from class:AbstractBootstrapReturns theAbstractBootstrapConfigobject that can be used to obtain the current config of the bootstrap.- Specified by:
configin classAbstractBootstrap<ServerBootstrap,ServerChannel>
-
-