Top Description Inners Fields Constructors Methods
io.netty5.util

public final Class NettyRuntime

extends Object
Class Inheritance
Imports
io.netty5.util.internal.ObjectUtil, .SystemPropertyUtil, java.util.Locale

A utility class for wrapping calls to Runtime.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
NettyRuntime.AvailableProcessorsHolder

Holder class for available processors to enable testing.

Field Summary

Modifier and TypeField and Description
private static final NettyRuntime.AvailableProcessorsHolder

Constructor Summary

AccessConstructor and Description
private
NettyRuntime()

No public constructor to prevent instances from being created.

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

the configured number of available processors
availableProcessors
()

Get the configured number of available processors.

public static void
setAvailableProcessors(final int
the number of available processors
availableProcessors
)

Set the number of available processors.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

holderback to summary
private static final NettyRuntime.AvailableProcessorsHolder holder

Constructor Detail

NettyRuntimeback to summary
private NettyRuntime()

No public constructor to prevent instances from being created.

Method Detail

availableProcessorsback to summary
public static int availableProcessors()

Get the configured number of available processors. The default is Runtime#availableProcessors(). This can be overridden by setting the system property "io.netty5.availableProcessors" or by invoking setAvailableProcessors(int) before any calls to this method.

Returns:int

the configured number of available processors

setAvailableProcessorsback to summary
public static void setAvailableProcessors(final int availableProcessors)

Set the number of available processors.

Parameters
availableProcessors:int

the number of available processors

Annotations
@SuppressWarnings:unused,WeakerAccess
Exceptions
IllegalArgumentException:
if the specified number of available processors is non-positive
IllegalStateException:
if the number of available processors is already configured
io.netty5.util back to summary

pack-priv Class NettyRuntime.AvailableProcessorsHolder

extends Object
Class Inheritance

Holder class for available processors to enable testing.

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv synchronized int

Returns:

the configured number of available processors
availableProcessors
()

Get the configured number of available processors.

pack-priv synchronized void
setAvailableProcessors(final int
the number of available processors
availableProcessors
)

Set the number of available processors.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

availableProcessorsback to summary
private int availableProcessors

Constructor Detail

AvailableProcessorsHolderback to summary
pack-priv AvailableProcessorsHolder()

Method Detail

availableProcessorsback to summary
pack-priv synchronized int availableProcessors()

Get the configured number of available processors. The default is Runtime#availableProcessors(). This can be overridden by setting the system property "io.netty5.availableProcessors" or by invoking setAvailableProcessors(int) before any calls to this method.

Returns:int

the configured number of available processors

Annotations
@SuppressForbidden
reason:to obtain default number of available processors
setAvailableProcessorsback to summary
pack-priv synchronized void setAvailableProcessors(final int availableProcessors)

Set the number of available processors.

Parameters
availableProcessors:int

the number of available processors

Exceptions
IllegalArgumentException:
if the specified number of available processors is non-positive
IllegalStateException:
if the number of available processors is already configured