Bootstrap Class — netty Architecture
Architecture documentation for the Bootstrap class in Bootstrap.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4080253b_1075_4ee4_570d_a7904062c2b8["Bootstrap"] a5d02ad9_06a3_d9a8_ca93_fd02877348ab["Bootstrap.java"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|defined in| a5d02ad9_06a3_d9a8_ca93_fd02877348ab 42c66118_416f_3bce_6291_8dcb1f0690a5["Bootstrap()"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|method| 42c66118_416f_3bce_6291_8dcb1f0690a5 dfddfff0_cb13_1601_2a46_f8a3506d4b72["ChannelFuture()"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|method| dfddfff0_cb13_1601_2a46_f8a3506d4b72 a03f938a_7a5d_5807_a0d1_2128cedad674["doConnect()"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|method| a03f938a_7a5d_5807_a0d1_2128cedad674 b3cf7f23_bbd9_3bba_3424_bd5a77030743["init()"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|method| b3cf7f23_bbd9_3bba_3424_bd5a77030743 9cb9c34b_96d2_8f89_3a6c_ec3b2430b31f["BootstrapConfig()"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|method| 9cb9c34b_96d2_8f89_3a6c_ec3b2430b31f 46f2ae23_dd47_53fd_5c32_fe08005bf243["SocketAddress()"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|method| 46f2ae23_dd47_53fd_5c32_fe08005bf243 392bc04a_2724_e8e5_cc98_623f40429b3b["resolver()"] 4080253b_1075_4ee4_570d_a7904062c2b8 -->|method| 392bc04a_2724_e8e5_cc98_623f40429b3b
Relationship Graph
Source Code
transport/src/main/java/io/netty/bootstrap/Bootstrap.java lines 47–348
public class Bootstrap extends AbstractBootstrap<Bootstrap, Channel> {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(Bootstrap.class);
private final BootstrapConfig config = new BootstrapConfig(this);
private ExternalAddressResolver externalResolver;
private volatile boolean disableResolver;
private volatile SocketAddress remoteAddress;
public Bootstrap() { }
private Bootstrap(Bootstrap bootstrap) {
super(bootstrap);
externalResolver = bootstrap.externalResolver;
disableResolver = bootstrap.disableResolver;
remoteAddress = bootstrap.remoteAddress;
}
/**
* Sets the {@link NameResolver} which will resolve the address of the unresolved named address.
*
* @param resolver the {@link NameResolver} for this {@code Bootstrap}; may be {@code null}, in which case a default
* resolver will be used
*
* @see io.netty.resolver.DefaultAddressResolverGroup
*/
public Bootstrap resolver(AddressResolverGroup<?> resolver) {
externalResolver = resolver == null ? null : new ExternalAddressResolver(resolver);
disableResolver = false;
return this;
}
/**
* Disables address name resolution. Name resolution may be re-enabled with
* {@link Bootstrap#resolver(AddressResolverGroup)}
*/
public Bootstrap disableResolver() {
externalResolver = null;
disableResolver = true;
return this;
}
/**
* The {@link SocketAddress} to connect to once the {@link #connect()} method
* is called.
*/
public Bootstrap remoteAddress(SocketAddress remoteAddress) {
this.remoteAddress = remoteAddress;
return this;
}
/**
* @see #remoteAddress(SocketAddress)
*/
public Bootstrap remoteAddress(String inetHost, int inetPort) {
remoteAddress = InetSocketAddress.createUnresolved(inetHost, inetPort);
return this;
}
/**
* @see #remoteAddress(SocketAddress)
*/
public Bootstrap remoteAddress(InetAddress inetHost, int inetPort) {
remoteAddress = new InetSocketAddress(inetHost, inetPort);
return this;
}
/**
* Connect a {@link Channel} to the remote peer.
*/
public ChannelFuture connect() {
validate();
SocketAddress remoteAddress = this.remoteAddress;
if (remoteAddress == null) {
throw new IllegalStateException("remoteAddress not set");
}
return doResolveAndConnect(remoteAddress, config.localAddress());
}
Source
Frequently Asked Questions
What is the Bootstrap class?
Bootstrap is a class in the netty codebase, defined in transport/src/main/java/io/netty/bootstrap/Bootstrap.java.
Where is Bootstrap defined?
Bootstrap is defined in transport/src/main/java/io/netty/bootstrap/Bootstrap.java at line 47.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free