Class NettyRuntime

java.lang.Object
io.netty.util.NettyRuntime

public final class NettyRuntime extends java.lang.Object
A utility class for wrapping calls to Runtime.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static class 
    Holder class for available processors to enable testing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    No public constructor to prevent instances from being created.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Get the configured number of available processors.
    static void
    setAvailableProcessors(int availableProcessors)
    Set the number of available processors.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • NettyRuntime

      private NettyRuntime()
      No public constructor to prevent instances from being created.
  • Method Details

    • 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-positive
      java.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 is Runtime.availableProcessors(). This can be overridden by setting the system property "io.netty.availableProcessors" or by invoking setAvailableProcessors(int) before any calls to this method.
      Returns:
      the configured number of available processors