Class ProcessorUtils


  • public class ProcessorUtils
    extends java.lang.Object

    ProcessorUtils provides access to runtime info about processors, that may be overridden by system properties or environment variables.

    This can be useful in virtualized environments where the runtime may miss report the available resources.

    • Constructor Summary

      Constructors 
      Constructor Description
      ProcessorUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int availableProcessors()
      Returns the number of available processors, from System Property "JETTY_AVAILABLE_PROCESSORS", or if not set then from environment variable "JETTY_AVAILABLE_PROCESSORS" or if not set then from Runtime.availableProcessors().
      (package private) static int init()  
      static void setAvailableProcessors​(int processors)  
      • Methods inherited from class java.lang.Object

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

      • AVAILABLE_PROCESSORS

        public static final java.lang.String AVAILABLE_PROCESSORS
        See Also:
        Constant Field Values
      • __availableProcessors

        private static int __availableProcessors
    • Constructor Detail

      • ProcessorUtils

        public ProcessorUtils()
    • Method Detail

      • init

        static int init()
      • availableProcessors

        public static int availableProcessors()
        Returns the number of available processors, from System Property "JETTY_AVAILABLE_PROCESSORS", or if not set then from environment variable "JETTY_AVAILABLE_PROCESSORS" or if not set then from Runtime.availableProcessors().
        Returns:
        the number of processors
      • setAvailableProcessors

        public static void setAvailableProcessors​(int processors)