public final class ServerBootstrap extends Object
Bootstrap sub-class which allows easy bootstrap of ServerChannel| Constructor and Description |
|---|
ServerBootstrap() |
| Modifier and Type | Method and Description |
|---|---|
<T> B |
attr(io.netty.util.AttributeKey<T> key,
T value)
Allow to specify an initial attribute of the newly created
Channel. |
ChannelFuture |
bind()
Create a new
Channel and bind it. |
ChannelFuture |
bind(InetAddress inetHost,
int inetPort)
Create a new
Channel and bind it. |
ChannelFuture |
bind(int inetPort)
Create a new
Channel and bind it. |
ChannelFuture |
bind(SocketAddress localAddress)
Create a new
Channel and bind it. |
ChannelFuture |
bind(String inetHost,
int inetPort)
Create a new
Channel and bind it. |
B |
channel(Class<? extends C> channelClass)
|
B |
channelFactory(ChannelFactory<? extends C> channelFactory)
|
<T> ServerBootstrap |
childAttr(io.netty.util.AttributeKey<T> childKey,
T value)
Set the specific
AttributeKey with the given value on every child Channel. |
EventLoopGroup |
childGroup()
Return the configured
EventLoopGroup which will be used for the child channels or null
if non is configured yet. |
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). |
ServerBootstrap |
clone()
Returns a deep clone of this bootstrap which has the identical configuration.
|
EventLoopGroup |
group()
Return the configured
EventLoopGroup or null if non is configured yet. |
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). |
B |
handler(ChannelHandler handler)
the
ChannelHandler to use for serving the requests. |
B |
localAddress(InetAddress inetHost,
int inetPort) |
B |
localAddress(int inetPort) |
B |
localAddress(SocketAddress localAddress)
The
SocketAddress which is used to bind the local "end" to. |
B |
localAddress(String inetHost,
int inetPort) |
<T> B |
option(ChannelOption<T> option,
T value)
Allow to specify a
ChannelOption which is used for the Channel instances once they got
created. |
String |
toString() |
ServerBootstrap |
validate()
Validate all the parameters.
|
public ServerBootstrap group(EventLoopGroup group)
EventLoopGroup which is used for the parent (acceptor) and the child (client).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 SocketChannel 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(io.netty.util.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.public EventLoopGroup childGroup()
EventLoopGroup which will be used for the child channels or null
if non is configured yet.public ServerBootstrap validate()
public ServerBootstrap clone()
Channels with similar settings. Please note that this method does not clone the
EventLoopGroup deeply but shallowly, making the group a shared resource.public String toString()
public B channel(Class<? extends C> channelClass)
Class which is used to create Channel instances from.
You either use this or channelFactory(ChannelFactory) if your
Channel implementation has no no-args constructor.public B channelFactory(ChannelFactory<? extends C> channelFactory)
ChannelFactory which is used to create Channel instances from
when calling bind(). This method is usually only used if channel(Class)
is not working for you because of some more complex needs. If your Channel implementation
has a no-args constructor, its highly recommend to just use channel(Class) for
simplify your code.public B localAddress(SocketAddress localAddress)
SocketAddress which is used to bind the local "end" to.public B localAddress(int inetPort)
#localAddress(SocketAddress)}public B localAddress(String inetHost, int inetPort)
#localAddress(SocketAddress)}public B localAddress(InetAddress inetHost, int inetPort)
#localAddress(SocketAddress)}public <T> B option(ChannelOption<T> option, T value)
ChannelOption which is used for the Channel instances once they got
created. Use a value of null to remove a previous set ChannelOption.public <T> B attr(io.netty.util.AttributeKey<T> key,
T value)
Channel. If the value is
null, the attribute of the specified key is removed.public ChannelFuture bind()
Channel and bind it.public ChannelFuture bind(int inetPort)
Channel and bind it.public ChannelFuture bind(String inetHost, int inetPort)
Channel and bind it.public ChannelFuture bind(InetAddress inetHost, int inetPort)
Channel and bind it.public ChannelFuture bind(SocketAddress localAddress)
Channel and bind it.public B handler(ChannelHandler handler)
ChannelHandler to use for serving the requests.public final EventLoopGroup group()
EventLoopGroup or null if non is configured yet.Copyright © 2008–2013 The Netty Project. All rights reserved.