Package io.netty.util
Class NettyRuntime
- java.lang.Object
-
- io.netty.util.NettyRuntime
-
public final class NettyRuntime extends java.lang.ObjectA utility class for wrapping calls toRuntime.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classNettyRuntime.AvailableProcessorsHolderHolder class for available processors to enable testing.
-
Field Summary
Fields Modifier and Type Field Description private static NettyRuntime.AvailableProcessorsHolderholder
-
Constructor Summary
Constructors Modifier Constructor Description privateNettyRuntime()No public constructor to prevent instances from being created.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intavailableProcessors()Get the configured number of available processors.static voidsetAvailableProcessors(int availableProcessors)Set the number of available processors.
-
-
-
Field Detail
-
holder
private static final NettyRuntime.AvailableProcessorsHolder holder
-
-
Method Detail
-
setAvailableProcessors
public static void setAvailableProcessors(int availableProcessors)
Set the number of available processors.- Parameters:
availableProcessors- the number of available processors- Throws:
java.lang.IllegalArgumentException- if the specified number of available processors is non-positivejava.lang.IllegalStateException- if the number of available processors is already configured
-
availableProcessors
public static int availableProcessors()
Get the configured number of available processors. The default isRuntime.availableProcessors(). This can be overridden by setting the system property "io.netty.availableProcessors" or by invokingsetAvailableProcessors(int)before any calls to this method.- Returns:
- the configured number of available processors
-
-