- java.lang.Object
-
- io.netty5.bootstrap.AbstractBootstrap<ServerBootstrap,ServerChannel,ServerChannelFactory<? extends ServerChannel>>
-
- io.netty5.bootstrap.ServerBootstrap
-
- All Implemented Interfaces:
Cloneable
public class ServerBootstrap extends AbstractBootstrap<ServerBootstrap,ServerChannel,ServerChannelFactory<? extends ServerChannel>>
Bootstrap
sub-class which allows easy bootstrap ofServerChannel
-
-
Constructor Summary
Constructors Constructor Description ServerBootstrap()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ServerBootstrap
channel(Class<? extends ServerChannel> channelClass)
TheClass
which is used to createServerChannel
instances from.ServerBootstrap
channelFactory(ServerChannelFactory<? extends ServerChannel> channelFactory)
ServerChannelFactory
which is used to createChannel
instances from when callingAbstractBootstrap.bind()
.<T> ServerBootstrap
childAttr(AttributeKey<T> childKey, T value)
Set the specificAttributeKey
with the given value on every childChannel
.EventLoopGroup
childGroup()
Deprecated.Useconfig()
instead.ServerBootstrap
childHandler(ChannelHandler childHandler)
Set theChannelHandler
which is used to serve the request for theChannel
's.<T> ServerBootstrap
childOption(ChannelOption<T> childOption, T value)
Allow to specify aChannelOption
which is used for theChannel
instances once they get created (after the acceptor accepted theChannel
).ServerBootstrap
clone()
Returns a deep clone of this bootstrap which has the identical configuration.ServerBootstrapConfig
config()
Returns theAbstractBootstrapConfig
object that can be used to obtain the current config of the bootstrap.ServerBootstrap
group(EventLoopGroup group)
Specify theEventLoopGroup
which is used for the parent (acceptor) and the child (client).ServerBootstrap
group(EventLoopGroup parentGroup, EventLoopGroup childGroup)
Set theEventLoopGroup
for the parent (acceptor) and the child (client).ServerBootstrap
validate()
Validate all the parameters.-
Methods inherited from class io.netty5.bootstrap.AbstractBootstrap
attr, bind, bind, bind, bind, bind, createUnregistered, group, handler, localAddress, localAddress, localAddress, localAddress, option, register, toString
-
-
-
-
Method Detail
-
group
public ServerBootstrap group(EventLoopGroup group)
Specify theEventLoopGroup
which is used for the parent (acceptor) and the child (client).- Overrides:
group
in classAbstractBootstrap<ServerBootstrap,ServerChannel,ServerChannelFactory<? extends ServerChannel>>
-
group
public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup)
Set theEventLoopGroup
for the parent (acceptor) and the child (client). TheseEventLoopGroup
's are used to handle all the events and IO forServerChannel
andChannel
's.
-
childOption
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value)
Allow to specify aChannelOption
which is used for theChannel
instances once they get created (after the acceptor accepted theChannel
). Use a value ofnull
to remove a previous setChannelOption
.
-
childAttr
public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value)
Set the specificAttributeKey
with the given value on every childChannel
. If the value isnull
theAttributeKey
is removed
-
childHandler
public ServerBootstrap childHandler(ChannelHandler childHandler)
Set theChannelHandler
which is used to serve the request for theChannel
's.
-
channel
public ServerBootstrap channel(Class<? extends ServerChannel> channelClass)
TheClass
which is used to createServerChannel
instances from. You either use this orchannelFactory(ServerChannelFactory)
if yourChannel
implementation has no no-args constructor.
-
channelFactory
public ServerBootstrap channelFactory(ServerChannelFactory<? extends ServerChannel> channelFactory)
ServerChannelFactory
which is used to createChannel
instances from when callingAbstractBootstrap.bind()
. This method is usually only used ifchannel(Class)
is not working for you because of some more complex needs. If yourChannel
implementation has a no-args constructor, its highly recommend to just usechannel(Class)
to simplify your code.
-
validate
public ServerBootstrap validate()
Description copied from class:AbstractBootstrap
Validate all the parameters. Sub-classes may override this, but should call the super method in that case.- Overrides:
validate
in classAbstractBootstrap<ServerBootstrap,ServerChannel,ServerChannelFactory<? extends ServerChannel>>
-
clone
public ServerBootstrap clone()
Description copied from class:AbstractBootstrap
Returns a deep clone of this bootstrap which has the identical configuration. This method is useful when making multipleChannel
s with similar settings. Please note that this method does not clone theEventLoopGroup
deeply but shallowly, making the group a shared resource.- Specified by:
clone
in classAbstractBootstrap<ServerBootstrap,ServerChannel,ServerChannelFactory<? extends ServerChannel>>
-
childGroup
@Deprecated public EventLoopGroup childGroup()
Deprecated.Useconfig()
instead.Return the configuredEventLoopGroup
which will be used for the child channels ornull
if non is configured yet.
-
config
public final ServerBootstrapConfig config()
Description copied from class:AbstractBootstrap
Returns theAbstractBootstrapConfig
object that can be used to obtain the current config of the bootstrap.- Specified by:
config
in classAbstractBootstrap<ServerBootstrap,ServerChannel,ServerChannelFactory<? extends ServerChannel>>
-
-