public abstract class AbstractBootstrap<B extends AbstractBootstrap<B,C>,C extends Channel> extends Object implements Cloneable
AbstractBootstrap is a helper class that makes it easy to bootstrap a Channel. It support
method-chaining to provide an easy way to configure the AbstractBootstrap.
When not used in a ServerBootstrap context, the bind() methods are useful for connectionless
transports such as datagram (UDP).
| 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. |
abstract B |
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. |
B |
group(EventLoopGroup group)
The
EventLoopGroup which is used to handle all the events for the to-be-created Channel |
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. |
ChannelFuture |
register()
Create a new
Channel and register it with an EventExecutorGroup. |
String |
toString() |
B |
validate()
Validate all the parameters.
|
public B group(EventLoopGroup group)
EventLoopGroup which is used to handle all the events for the to-be-created Channelpublic 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 B validate()
public abstract B clone()
Channels with similar settings. Please note that this method does not clone the
EventExecutorGroup deeply but shallowly, making the group a shared resource.public ChannelFuture register()
Channel and register it with an EventExecutorGroup.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.