AvailableProcessorsHolder Class — netty Architecture
Architecture documentation for the AvailableProcessorsHolder class in NettyRuntime.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0d6ff260_a264_fefa_f6ad_a83ba5c991cc["AvailableProcessorsHolder"] 883e532e_3203_7d89_be8d_632292f3409b["NettyRuntime.java"] 0d6ff260_a264_fefa_f6ad_a83ba5c991cc -->|defined in| 883e532e_3203_7d89_be8d_632292f3409b 732fe3c8_3c7b_6956_b836_bddac489b045["setAvailableProcessors()"] 0d6ff260_a264_fefa_f6ad_a83ba5c991cc -->|method| 732fe3c8_3c7b_6956_b836_bddac489b045 4f67f30d_daf6_1441_b2cc_6ad5d3a5ced4["availableProcessors()"] 0d6ff260_a264_fefa_f6ad_a83ba5c991cc -->|method| 4f67f30d_daf6_1441_b2cc_6ad5d3a5ced4
Relationship Graph
Source Code
common/src/main/java/io/netty/util/NettyRuntime.java lines 32–74
static class AvailableProcessorsHolder {
private int availableProcessors;
/**
* Set the number of available processors.
*
* @param availableProcessors the number of available processors
* @throws IllegalArgumentException if the specified number of available processors is non-positive
* @throws IllegalStateException if the number of available processors is already configured
*/
synchronized void setAvailableProcessors(final int availableProcessors) {
ObjectUtil.checkPositive(availableProcessors, "availableProcessors");
if (this.availableProcessors != 0) {
final String message = String.format(
Locale.ROOT,
"availableProcessors is already set to [%d], rejecting [%d]",
this.availableProcessors,
availableProcessors);
throw new IllegalStateException(message);
}
this.availableProcessors = availableProcessors;
}
/**
* Get the configured number of available processors. The default is {@link Runtime#availableProcessors()}.
* This can be overridden by setting the system property "io.netty.availableProcessors" or by invoking
* {@link #setAvailableProcessors(int)} before any calls to this method.
*
* @return the configured number of available processors
*/
@SuppressForbidden(reason = "to obtain default number of available processors")
synchronized int availableProcessors() {
if (this.availableProcessors == 0) {
final int availableProcessors =
SystemPropertyUtil.getInt(
"io.netty.availableProcessors",
Runtime.getRuntime().availableProcessors());
setAvailableProcessors(availableProcessors);
}
return this.availableProcessors;
}
}
Source
Frequently Asked Questions
What is the AvailableProcessorsHolder class?
AvailableProcessorsHolder is a class in the netty codebase, defined in common/src/main/java/io/netty/util/NettyRuntime.java.
Where is AvailableProcessorsHolder defined?
AvailableProcessorsHolder is defined in common/src/main/java/io/netty/util/NettyRuntime.java at line 32.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free