Top Description Fields Constructors Methods
io.netty5.bootstrap

public Class Bootstrap

extends AbstractBootstrap<Bootstrap, Channel, ChannelFactory<? extends Channel>>
Class Inheritance
Imports
io.netty5.channel.Channel, .ChannelFactory, .ChannelFutureListeners, .ChannelPipeline, .EventLoop, .EventLoopGroup, .ReflectiveChannelFactory, io.netty5.resolver.AddressResolver, .AddressResolverGroup, .DefaultAddressResolverGroup, .NameResolver, io.netty5.util.concurrent.Future, .Promise, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.InetAddress, .InetSocketAddress, .SocketAddress

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.

Field Summary

Modifier and TypeField and Description
pack-priv volatile ChannelFactory<? extends Channel>
private final BootstrapConfig
private static final AddressResolverGroup<?>
private static final InternalLogger
private volatile SocketAddress
private volatile AddressResolverGroup<SocketAddress>
Inherited from io.netty5.bootstrap.AbstractBootstrap:
group

Constructor Summary

AccessConstructor and Description
public
private
Bootstrap(Bootstrap bootstrap)

Method Summary

Modifier and TypeMethod and Description
public Bootstrap
channel(Class<? extends Channel> channelClass)

The Class which is used to create Channel instances from.

public Bootstrap
channelFactory(ChannelFactory<? extends Channel> channelFactory)

ChannelFactory which is used to create Channel instances from when calling bind().

public Bootstrap
clone()

Implements abstract io.netty5.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.netty5.bootstrap.AbstractBootstrap.config.

Returns the AbstractBootstrapConfig object that can be used to obtain the current config of the bootstrap.
public Future<Channel>
connect()

Connect a Channel to the remote peer.

public Future<Channel>
connect(String inetHost, int inetPort)

Connect a Channel to the remote peer.

public Future<Channel>
connect(InetAddress inetHost, int inetPort)

Connect a Channel to the remote peer.

public Future<Channel>
connect(SocketAddress remoteAddress)

Connect a Channel to the remote peer.

public Future<Channel>
connect(SocketAddress remoteAddress, SocketAddress localAddress)

Connect a Channel to the remote peer.

private static void
doConnect(SocketAddress remoteAddress, SocketAddress localAddress, Channel channel, Promise<Channel> promise)

private Future<Channel>
doResolveAndConnect(final SocketAddress remoteAddress, final SocketAddress localAddress)

private void
doResolveAndConnect0(final Channel channel, SocketAddress remoteAddress, final SocketAddress localAddress, final Promise<Channel> promise)

pack-priv Future<Channel>
pack-priv Channel
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.netty5.bootstrap.AbstractBootstrap.validate.

Validate all the parameters.
Inherited from io.netty5.bootstrap.AbstractBootstrap:
attrattrsbindbindbindbindbindcopiedMapcreateUnregisteredgroupgrouphandlerhandlerinitAndRegisterinitWithoutRegisterlocalAddresslocalAddresslocalAddresslocalAddresslocalAddressnewAttributesArraynewAttributesArraynewOptionsArraynewOptionsArrayoptionoptionsregistersetAttributessetChannelOptionstoString

Field Detail

channelFactoryback to summary
pack-priv volatile ChannelFactory<? extends Channel> channelFactory
configback to summary
private final BootstrapConfig config
DEFAULT_RESOLVERback to summary
private static final AddressResolverGroup<?> DEFAULT_RESOLVER
loggerback to summary
private static final InternalLogger logger
remoteAddressback to summary
private volatile SocketAddress remoteAddress
resolverback to summary
private volatile AddressResolverGroup<SocketAddress> resolver
Annotations
@SuppressWarnings:unchecked

Constructor Detail

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

Method Detail

channelback to summary
public Bootstrap channel(Class<? extends Channel> channelClass)

The 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.

channelFactoryback to summary
public Bootstrap channelFactory(ChannelFactory<? extends Channel> 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) to simplify your code.

cloneback to summary
public Bootstrap clone()

Implements abstract io.netty5.bootstrap.AbstractBootstrap.clone.

Doc from io.netty5.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.netty5.bootstrap.AbstractBootstrap.config.

Doc from io.netty5.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 Future<Channel> connect()

Connect a Channel to the remote peer.

connectback to summary
public Future<Channel> connect(String inetHost, int inetPort)

Connect a Channel to the remote peer.

connectback to summary
public Future<Channel> connect(InetAddress inetHost, int inetPort)

Connect a Channel to the remote peer.

connectback to summary
public Future<Channel> connect(SocketAddress remoteAddress)

Connect a Channel to the remote peer.

connectback to summary
public Future<Channel> connect(SocketAddress remoteAddress, SocketAddress localAddress)

Connect a Channel to the remote peer.

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

Implements abstract io.netty5.bootstrap.AbstractBootstrap.init.

Annotations
@Override
newChannelback to summary
pack-priv Channel newChannel(EventLoop eventLoop) throws Exception

Implements abstract io.netty5.bootstrap.AbstractBootstrap.newChannel.

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

Annotations
@SuppressWarnings:unchecked
See Also
DefaultAddressResolverGroup
resolverback to summary
pack-priv final AddressResolverGroup<?> resolver()
validateback to summary
public Bootstrap validate()

Overrides io.netty5.bootstrap.AbstractBootstrap.validate.

Doc from io.netty5.bootstrap.AbstractBootstrap.validate.

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

Annotations
@Override