Package io.netty.bootstrap
Class Bootstrap
- All Implemented Interfaces:
Cloneable
A
Bootstrap
that makes it easy to bootstrap a Channel
to use
for clients.
The AbstractBootstrap.bind()
methods are useful in combination with connectionless transports such as datagram (UDP).
For regular TCP connections, please use the provided connect()
methods.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
Nested classes/interfaces inherited from class io.netty.bootstrap.AbstractBootstrap
AbstractBootstrap.PendingRegistrationPromise
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BootstrapConfig
private boolean
private static final InternalLogger
private SocketAddress
Fields inherited from class io.netty.bootstrap.AbstractBootstrap
group
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a deep clone of this bootstrap which has the identical configuration.clone
(EventLoopGroup group) Returns a deep clone of this bootstrap which has the identical configuration except that it uses the givenEventLoopGroup
.final BootstrapConfig
config()
Returns theAbstractBootstrapConfig
object that can be used to obtain the current config of the bootstrap.connect()
Connect aChannel
to the remote peer.Connect aChannel
to the remote peer.connect
(InetAddress inetHost, int inetPort) Connect aChannel
to the remote peer.connect
(SocketAddress remoteAddress) Connect aChannel
to the remote peer.connect
(SocketAddress remoteAddress, SocketAddress localAddress) Connect aChannel
to the remote peer.Disables address name resolution.private static void
doConnect
(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise connectPromise) private ChannelFuture
doResolveAndConnect
(SocketAddress remoteAddress, SocketAddress localAddress) private ChannelFuture
doResolveAndConnect0
(Channel channel, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) (package private) void
(package private) final SocketAddress
remoteAddress
(String inetHost, int inetPort) remoteAddress
(InetAddress inetHost, int inetPort) remoteAddress
(SocketAddress remoteAddress) TheSocketAddress
to connect to once theconnect()
method is called.(package private) final AddressResolverGroup
<?> resolver()
resolver
(AddressResolverGroup<?> resolver) Sets theNameResolver
which will resolve the address of the unresolved named address.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, extensionsClassLoader, getInitializerExtensions, group, group, handler, handler, initAndRegister, localAddress, localAddress, localAddress, localAddress, localAddress, newAttributesArray, newAttributesArray, newOptionsArray, newOptionsArray, option, options, options0, register, setAttributes, setChannelOptions, toString
-
Field Details
-
logger
-
config
-
externalResolver
-
disableResolver
private volatile boolean disableResolver -
remoteAddress
-
-
Constructor Details
-
Bootstrap
public Bootstrap() -
Bootstrap
-
-
Method Details
-
resolver
Sets theNameResolver
which will resolve the address of the unresolved named address.- Parameters:
resolver
- theNameResolver
for thisBootstrap
; may benull
, in which case a default resolver will be used- See Also:
-
disableResolver
Disables address name resolution. Name resolution may be re-enabled withresolver(AddressResolverGroup)
-
remoteAddress
TheSocketAddress
to connect to once theconnect()
method is called. -
remoteAddress
- See Also:
-
remoteAddress
- See Also:
-
connect
Connect aChannel
to the remote peer. -
connect
Connect aChannel
to the remote peer. -
connect
Connect aChannel
to the remote peer. -
connect
Connect aChannel
to the remote peer. -
connect
Connect aChannel
to the remote peer. -
doResolveAndConnect
- See Also:
-
doResolveAndConnect0
private ChannelFuture doResolveAndConnect0(Channel channel, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) -
doConnect
private static void doConnect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise connectPromise) -
init
- Specified by:
init
in classAbstractBootstrap<Bootstrap,
Channel>
-
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<Bootstrap,
Channel>
-
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<Bootstrap,
Channel>
-
clone
Returns a deep clone of this bootstrap which has the identical configuration except that it uses the givenEventLoopGroup
. This method is useful when making multipleChannel
s with similar settings. -
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<Bootstrap,
Channel>
-
remoteAddress
-
resolver
-