public class ServerBootstrap extends AbstractBootstrap<ServerBootstrap,ServerChannel>
Bootstrap
sub-class which allows easy bootstrap of ServerChannel
Modifier and Type | Class and Description |
---|---|
private static class |
ServerBootstrap.ServerBootstrapAcceptor |
AbstractBootstrap.PendingRegistrationPromise
Modifier and Type | Field and 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 |
group
Modifier | Constructor and Description |
---|---|
|
ServerBootstrap() |
private |
ServerBootstrap(ServerBootstrap bootstrap) |
Modifier and Type | Method and Description |
---|---|
<T> ServerBootstrap |
childAttr(AttributeKey<T> childKey,
T value)
Set the specific
AttributeKey with the given value on every child Channel . |
(package private) java.util.Map<AttributeKey<?>,java.lang.Object> |
childAttrs() |
EventLoopGroup |
childGroup()
Deprecated.
Use
config() instead. |
(package private) ChannelHandler |
childHandler() |
ServerBootstrap |
childHandler(ChannelHandler childHandler)
Set the
ChannelHandler which is used to serve the request for the Channel 's. |
<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 ). |
(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 the
AbstractBootstrapConfig object that can be used to obtain the current config
of the bootstrap. |
ServerBootstrap |
group(EventLoopGroup group)
Specify the
EventLoopGroup which is used for the parent (acceptor) and the child (client). |
ServerBootstrap |
group(EventLoopGroup parentGroup,
EventLoopGroup childGroup)
Set the
EventLoopGroup for the parent (acceptor) and the child (client). |
(package private) void |
init(Channel channel) |
private static java.util.Map.Entry<AttributeKey<?>,java.lang.Object>[] |
newAttrArray(int size) |
private static java.util.Map.Entry<ChannelOption<?>,java.lang.Object>[] |
newOptionArray(int size) |
ServerBootstrap |
validate()
Validate all the parameters.
|
attr, attrs, attrs0, bind, bind, bind, bind, bind, channel, channelFactory, channelFactory, channelFactory, copiedMap, group, handler, handler, initAndRegister, localAddress, localAddress, localAddress, localAddress, localAddress, option, options, options0, register, setChannelOptions, setChannelOptions, toString
private static final InternalLogger logger
private final java.util.Map<ChannelOption<?>,java.lang.Object> childOptions
private final java.util.Map<AttributeKey<?>,java.lang.Object> childAttrs
private final ServerBootstrapConfig config
private volatile EventLoopGroup childGroup
private volatile ChannelHandler childHandler
public ServerBootstrap()
private ServerBootstrap(ServerBootstrap bootstrap)
public ServerBootstrap group(EventLoopGroup group)
EventLoopGroup
which is used for the parent (acceptor) and the child (client).group
in class AbstractBootstrap<ServerBootstrap,ServerChannel>
public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup)
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.public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value)
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
.public <T> ServerBootstrap childAttr(AttributeKey<T> childKey, T value)
AttributeKey
with the given value on every child Channel
. If the value is
null
the AttributeKey
is removedpublic ServerBootstrap childHandler(ChannelHandler childHandler)
ChannelHandler
which is used to serve the request for the Channel
's.void init(Channel channel) throws java.lang.Exception
init
in class AbstractBootstrap<ServerBootstrap,ServerChannel>
java.lang.Exception
public ServerBootstrap validate()
AbstractBootstrap
validate
in class AbstractBootstrap<ServerBootstrap,ServerChannel>
private static java.util.Map.Entry<AttributeKey<?>,java.lang.Object>[] newAttrArray(int size)
private static java.util.Map.Entry<ChannelOption<?>,java.lang.Object>[] newOptionArray(int size)
public ServerBootstrap clone()
AbstractBootstrap
Channel
s with similar settings. Please note that this method does not clone the
EventLoopGroup
deeply but shallowly, making the group a shared resource.clone
in class AbstractBootstrap<ServerBootstrap,ServerChannel>
@Deprecated public EventLoopGroup childGroup()
config()
instead.EventLoopGroup
which will be used for the child channels or null
if non is configured yet.final ChannelHandler childHandler()
final java.util.Map<ChannelOption<?>,java.lang.Object> childOptions()
final java.util.Map<AttributeKey<?>,java.lang.Object> childAttrs()
public final ServerBootstrapConfig config()
AbstractBootstrap
AbstractBootstrapConfig
object that can be used to obtain the current config
of the bootstrap.config
in class AbstractBootstrap<ServerBootstrap,ServerChannel>