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>
Bootstrap
sub-class which allows easy bootstrap ofServerChannel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ServerBootstrap.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>
childAttrs
private EventLoopGroup
childGroup
private ChannelHandler
childHandler
private java.util.Map<ChannelOption<?>,java.lang.Object>
childOptions
private ServerBootstrapConfig
config
private static InternalLogger
logger
-
Fields inherited from class io.netty.bootstrap.AbstractBootstrap
group
-
-
Constructor Summary
Constructors Modifier Constructor Description ServerBootstrap()
private
ServerBootstrap(ServerBootstrap bootstrap)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> ServerBootstrap
childAttr(AttributeKey<T> childKey, T value)
Set the specificAttributeKey
with the given value on every childChannel
.(package private) java.util.Map<AttributeKey<?>,java.lang.Object>
childAttrs()
EventLoopGroup
childGroup()
Deprecated.Useconfig()
instead.(package private) ChannelHandler
childHandler()
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
).(package private) java.util.Map<ChannelOption<?>,java.lang.Object>
childOptions()
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).(package private) void
init(Channel channel)
ServerBootstrap
validate()
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, newAttributesArray, newAttributesArray, newOptionsArray, 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 theEventLoopGroup
which is used for the parent (acceptor) and the child (client).- Overrides:
group
in classAbstractBootstrap<ServerBootstrap,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.
-
init
void init(Channel channel)
- Specified by:
init
in classAbstractBootstrap<ServerBootstrap,ServerChannel>
-
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>
-
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>
-
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.
-
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:AbstractBootstrap
Returns theAbstractBootstrapConfig
object that can be used to obtain the current config of the bootstrap.- Specified by:
config
in classAbstractBootstrap<ServerBootstrap,ServerChannel>
-
-