Top Description Inners Fields Constructors Methods
io.netty.bootstrap

public Class Bootstrap

extends AbstractBootstrap<Bootstrap, Channel>
Class Inheritance
Imports
io.netty.channel.Channel, .ChannelFuture, .ChannelFutureListener, .ChannelPipeline, .ChannelPromise, .EventLoop, .EventLoopGroup, io.netty.resolver.AddressResolver, .AddressResolverGroup, .DefaultAddressResolverGroup, .NameResolver, io.netty.util.concurrent.Future, .FutureListener, io.netty.util.internal.ObjectUtil, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.InetAddress, .InetSocketAddress, .SocketAddress, java.util.Collection

A Bootstrap that makes it easy to bootstrap a Channel to use for clients.

The bind() methods are useful in combination with connectionless transports such as datagram (UDP). For regular TCP connections, please use the provided connect() methods.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final BootstrapConfig
private volatile boolean
private Bootstrap.ExternalAddressResolver
private static final InternalLogger
private volatile SocketAddress
Inherited from io.netty.bootstrap.AbstractBootstrap:
group

Constructor Summary

AccessConstructor and Description
public
private
Bootstrap(Bootstrap bootstrap)

Method Summary

Modifier and TypeMethod and Description
public Bootstrap
clone()

Implements abstract io.netty.bootstrap.AbstractBootstrap.clone.

Returns a deep clone of this bootstrap which has the identical configuration.
public Bootstrap
clone(EventLoopGroup group)

Returns a deep clone of this bootstrap which has the identical configuration except that it uses the given EventLoopGroup.

public final BootstrapConfig
config()

Implements abstract io.netty.bootstrap.AbstractBootstrap.config.

Returns the AbstractBootstrapConfig object that can be used to obtain the current config of the bootstrap.
public ChannelFuture
connect()

Connect a Channel to the remote peer.

public ChannelFuture
connect(String inetHost, int inetPort)

Connect a Channel to the remote peer.

public ChannelFuture
connect(InetAddress inetHost, int inetPort)

Connect a Channel to the remote peer.

public ChannelFuture
connect(SocketAddress remoteAddress)

Connect a Channel to the remote peer.

public ChannelFuture
connect(SocketAddress remoteAddress, SocketAddress localAddress)

Connect a Channel to the remote peer.

public Bootstrap
disableResolver()

Disables address name resolution.

private static void
doConnect(final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise connectPromise)

private ChannelFuture
doResolveAndConnect(final SocketAddress remoteAddress, final SocketAddress localAddress)

private ChannelFuture
doResolveAndConnect0(final Channel channel, SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise)

pack-priv void
public Bootstrap
remoteAddress(SocketAddress remoteAddress)

The SocketAddress to connect to once the connect() method is called.

public Bootstrap
remoteAddress(String inetHost, int inetPort)

public Bootstrap
remoteAddress(InetAddress inetHost, int inetPort)

pack-priv final SocketAddress
public Bootstrap
resolver(AddressResolverGroup<?>
the NameResolver for this Bootstrap; may be null, in which case a default resolver will be used
resolver
)

Sets the NameResolver which will resolve the address of the unresolved named address.

pack-priv final AddressResolverGroup<?>
public Bootstrap
validate()

Overrides io.netty.bootstrap.AbstractBootstrap.validate.

Validate all the parameters.
Inherited from io.netty.bootstrap.AbstractBootstrap:
attrattrsattrs0bindbindbindbindbindchannelchannelFactorychannelFactorychannelFactorycopiedMapextensionsClassLoadergetInitializerExtensionsgroupgrouphandlerhandlerinitAndRegisterlocalAddresslocalAddresslocalAddresslocalAddresslocalAddressnewAttributesArraynewAttributesArraynewOptionsArraynewOptionsArrayoptionoptionsoptions0registersetAttributessetChannelOptionstoString

Field Detail

configback to summary
private final BootstrapConfig config
disableResolverback to summary
private volatile boolean disableResolver
externalResolverback to summary
private Bootstrap.ExternalAddressResolver externalResolver
loggerback to summary
private static final InternalLogger logger
remoteAddressback to summary
private volatile SocketAddress remoteAddress

Constructor Detail

Bootstrapback to summary
public Bootstrap()
Bootstrapback to summary
private Bootstrap(Bootstrap bootstrap)

Method Detail

cloneback to summary
public Bootstrap clone()

Implements abstract io.netty.bootstrap.AbstractBootstrap.clone.

Doc from io.netty.bootstrap.AbstractBootstrap.clone.

Returns a deep clone of this bootstrap which has the identical configuration. This method is useful when making multiple Channels with similar settings. Please note that this method does not clone the EventLoopGroup deeply but shallowly, making the group a shared resource.

Returns:Bootstrap

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
@SuppressWarnings:CloneDoesntCallSuperClone
cloneback to summary
public Bootstrap clone(EventLoopGroup group)

Returns a deep clone of this bootstrap which has the identical configuration except that it uses the given EventLoopGroup. This method is useful when making multiple Channels with similar settings.

configback to summary
public final BootstrapConfig config()

Implements abstract io.netty.bootstrap.AbstractBootstrap.config.

Doc from io.netty.bootstrap.AbstractBootstrap.config.

Returns the AbstractBootstrapConfig object that can be used to obtain the current config of the bootstrap.

Annotations
@Override
connectback to summary
public ChannelFuture connect()

Connect a Channel to the remote peer.

connectback to summary
public ChannelFuture connect(String inetHost, int inetPort)

Connect a Channel to the remote peer.

connectback to summary
public ChannelFuture connect(InetAddress inetHost, int inetPort)

Connect a Channel to the remote peer.

connectback to summary
public ChannelFuture connect(SocketAddress remoteAddress)

Connect a Channel to the remote peer.

connectback to summary
public ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)

Connect a Channel to the remote peer.

disableResolverback to summary
public Bootstrap disableResolver()

Disables address name resolution. Name resolution may be re-enabled with Bootstrap#resolver(AddressResolverGroup)

doConnectback to summary
private static void doConnect(final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise connectPromise)
doResolveAndConnectback to summary
private ChannelFuture doResolveAndConnect(final SocketAddress remoteAddress, final SocketAddress localAddress)
See Also
connect()
doResolveAndConnect0back to summary
private ChannelFuture doResolveAndConnect0(final Channel channel, SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise)
initback to summary
pack-priv void init(Channel channel)

Implements abstract io.netty.bootstrap.AbstractBootstrap.init.

Annotations
@Override
remoteAddressback to summary
public Bootstrap remoteAddress(SocketAddress remoteAddress)

The SocketAddress to connect to once the connect() method is called.

remoteAddressback to summary
public Bootstrap remoteAddress(String inetHost, int inetPort)
See Also
remoteAddress(SocketAddress)
remoteAddressback to summary
public Bootstrap remoteAddress(InetAddress inetHost, int inetPort)
See Also
remoteAddress(SocketAddress)
remoteAddressback to summary
pack-priv final SocketAddress remoteAddress()
resolverback to summary
public Bootstrap resolver(AddressResolverGroup<?> resolver)

Sets the NameResolver which will resolve the address of the unresolved named address.

Parameters
resolver:AddressResolverGroup<?>

the NameResolver for this Bootstrap; may be null, in which case a default resolver will be used

See Also
io.netty.resolver.DefaultAddressResolverGroup
resolverback to summary
pack-priv final AddressResolverGroup<?> resolver()
validateback to summary
public Bootstrap validate()

Overrides io.netty.bootstrap.AbstractBootstrap.validate.

Doc from io.netty.bootstrap.AbstractBootstrap.validate.

Validate all the parameters. Sub-classes may override this, but should call the super method in that case.

Annotations
@Override
io.netty.bootstrap back to summary

pack-priv final Class Bootstrap.ExternalAddressResolver

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final AddressResolverGroup<SocketAddress>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static AddressResolverGroup<SocketAddress>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

resolverGroupback to summary
pack-priv final AddressResolverGroup<SocketAddress> resolverGroup

Constructor Detail

ExternalAddressResolverback to summary
pack-priv ExternalAddressResolver(AddressResolverGroup<?> resolverGroup)
Annotations
@SuppressWarnings:unchecked

Method Detail

getOrDefaultback to summary
pack-priv static AddressResolverGroup<SocketAddress> getOrDefault(Bootstrap.ExternalAddressResolver externalResolver)
Annotations
@SuppressWarnings:unchecked