Class JPPFSystemInformation

java.lang.Object
org.jppf.management.JPPFSystemInformation
All Implemented Interfaces:
Serializable, PropertiesCollection<String>

public class JPPFSystemInformation extends Object implements PropertiesCollection<String>
This class encapsulates the system information for a node.
It includes:
  • System properties, including -D flags
  • Runtime information such as available processors and memory usage
  • Environment variables
  • JPPF configuration properties
  • IPV4 and IPV6 addresses assigned to the JVM host
  • Disk space information
  • Server statistics (server-side only)
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • JPPFSystemInformation

      public JPPFSystemInformation(TypedProperties jppfConfig, String uuid, boolean local, boolean resolveInetAddressesNow)
      Initialize this system information object with the specified uuid.
      Parameters:
      jppfConfig - the JPPF configuration.
      uuid - the uuid of the corresponding JPPF component.
      local - true if the JPPF component is local (local node or local client executor), false otherwise.
      resolveInetAddressesNow - if true, then name resolution for InetAddresses should occur immediately, otherwise it is different and executed in a separate thread.
    • JPPFSystemInformation

      public JPPFSystemInformation(TypedProperties jppfConfig, String uuid, boolean local, boolean resolveInetAddressesNow, JPPFStatistics stats)
      Initialize this system information object with the specified uuid.
      Parameters:
      jppfConfig - the JPPF configuration.
      uuid - the uuid of the corresponding JPPF component.
      local - true if the JPPF component is local (local node or local client executor), false otherwise.
      resolveInetAddressesNow - if true, then name resolution for InetAddresses should occur immediately, otherwise it is different and executed in a separate thread.
      stats - an optional statistics object from which events can be received so the corresponding properties can be kept up to date.
  • Method Details

    • getSystem

      public TypedProperties getSystem()
      Get the map holding the system properties.
      Returns:
      a TypedProperties instance.
      See Also:
    • getRuntime

      public TypedProperties getRuntime()
      Get the map holding the runtime information.

      The resulting map will contain the following properties:

      • availableProcessors = number of processors available to the JVM
      • freeMemory = current free heap size in bytes
      • totalMemory = current total heap size in bytes
      • maxMemory = maximum heap size in bytes (i.e. as specified by -Xmx JVM option)
      • usedMemory = currently used heap memory in bytes
      • availableMemory = the currently available heap memory in bytes; equal to: maxMemory - usedMemory
      • startTime = the approximate timestamp in millis of when the JVM started
      • upTime = how long the JVM has been up in millis
      • inputArgs = arguments given to the 'java' command, excluding those passed to the main method. Arguments are given as a list of strings separated by the ", " delimiter (a comma followed by a space)

      Some or all of these properties may be missing if a security manager is installed that does not grant access to the related Runtime APIs.

      Returns:
      a TypedProperties instance.
      See Also:
    • getEnv

      public TypedProperties getEnv()
      Get the map holding the environment variables.
      Returns:
      a TypedProperties instance.
      See Also:
    • getNetwork

      public TypedProperties getNetwork()
      Get the map of the network configuration.

      The resulting map will contain the following properties:

      • ipv4.addresses = hostname_1|ipv4_address_1 ... hostname_n|ipv4_address_n
      • ipv6.addresses = hostname_1|ipv6_address_1 ... hostname_p|ipv6_address_p

      Each property is a space-separated list of hostname|ip_address pairs, the hostname and ip address being separated by a pipe symbol "|".

      Returns:
      a TypedProperties instance.
      See Also:
    • getJppf

      public TypedProperties getJppf()
      Get the map holding the JPPF configuration properties.
      Returns:
      a TypedProperties instance.
      See Also:
    • getStorage

      public TypedProperties getStorage()
      Get the map holding the host storage information.

      The map will contain the following information:

      • host.roots.names = root_name_0 ... root_name_n-1 : the names of all accessible file system roots
      • host.roots.number = n : the number of accessible file system roots
      • For each root i:
      • root.i.name = root_name : for instance "C:\" on Windows or "/" on Unix
      • root.i.space.free = space_in_bytes : current free space for the root
      • root.i.space.total = space_in_bytes : total space for the root
      • root.i.space.usable = space_in_bytes : space available to the user the JVM is running under
      If the JVM version is prior to 1.6, the space information will not be available.
      Returns:
      a TypedProperties instance.
      See Also:
    • getUuid

      public TypedProperties getUuid()
      Get the properties object holding the JPPF uuid and version information. The following properties are provided:
      • "jppf.uuid" : the uuid of the node or driver
      • "jppf.pid" : the process id of the JVM running the JPPF driver or node
      • "jppf.version.number" : the current JPPF version number
      • "jppf.build.number" : the current build number
      • "jppf.build.date" : the build date, including the time zone, in the format "yyyy-MM-dd hh:mm z"
      Returns:
      a TypedProperties wrapper for the uuid and version information of the corresponding JPPF component.
    • getStats

      public TypedProperties getStats()
      Get the properties object holding the JPPF server statistics, listed as constants in JPPFStatisticsHelper.
      Returns:
      a TypedProperties wrapper for the server statistics; for a node this will return an empty set of properties.
    • getOS

      public TypedProperties getOS()
      Get the properties object holding the operating system information. The following properties are provided:
      • "os.TotalPhysicalMemorySize" : total physical RAM (long value)
      • "os.FreePhysicalMemorySize" : available physical RAM (long value)
      • "os.TotalSwapSpaceSize" : total swap space (long value)
      • "os.FreeSwapSpaceSize" : available swap space (long value)
      • "os.CommittedVirtualMemorySize" : total committed virtual memory of the process (long value)
      • "os.ProcessCpuLoad" : process CPU load (double value in range [0 ... 1])
      • "os.ProcessCpuTime" : process CPU time (long value)
      • "os.SystemCpuLoad" : system total CPU load (double value in range [0 ... 1])
      • "os.Name" : the name of the OS (string value, ex: "Windows 7")
      • "os.Version" : the OS version (string value, ex: "6.1")
      • "os.Arch" : the OS architecture (string value, ex: "amd64")
      • "os.AvailableProcessors" : number of processors available to the OS (int value)
      • "os.SystemLoadAverage" : average system CPU load over the last minute (double value in the range [0 ... 1], always returns -1 on Windows)
      Returns:
      a TypedProperties wrapper for the operating system information of the corresponding JPPF component.
    • getPropertiesArray

      public TypedProperties[] getPropertiesArray()
      Get all the properties as an array.
      Specified by:
      getPropertiesArray in interface PropertiesCollection<String>
      Returns:
      an array of all the sets of properties.
    • addProperties

      public void addProperties(String key, TypedProperties properties)
      Description copied from interface: PropertiesCollection
      Add the specified properties with the specified keys.
      Specified by:
      addProperties in interface PropertiesCollection<String>
      Parameters:
      key - the key to use.
      properties - the properties to add.
    • getProperties

      public TypedProperties getProperties(String key)
      Description copied from interface: PropertiesCollection
      Add the specified properties with the specified key.
      Specified by:
      getProperties in interface PropertiesCollection<String>
      Parameters:
      key - the key to use to retrieve the properties.
      Returns:
      the properties to correponding to the key, or null if the key could not be found.
    • populate

      public JPPFSystemInformation populate()
      Populate this system information object.
      Returns:
      this JPPFSystemInformation object.
    • parseIPV4Addresses

      public HostIP[] parseIPV4Addresses()
      Parse the list of IP v4 addresses contained in this JPPFSystemInformation instance.
      This method is provided as a convenience so developers don't have to do the parsing themselves.
      Returns:
      an array of HostIP instances.
    • parseIPV6Addresses

      public HostIP[] parseIPV6Addresses()
      Parse the list of IP v6 addresses contained in this JPPFSystemInformation instance.
      This method is provided as a convenience so developers don't have to do the parsing themselves.
      Returns:
      an array of HostIP instances.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getProperty

      public String getProperty(String name)
      Description copied from interface: PropertiesCollection
      Get the value of the property with the specified name.
      Specified by:
      getProperty in interface PropertiesCollection<String>
      Parameters:
      name - the name of the property to find.
      Returns:
      the proerty value, or null if the property could not be found.
    • containsKey

      public boolean containsKey(String name)
      Description copied from interface: PropertiesCollection
      Determine whether this properties collection contains a property witht he specified key.
      Specified by:
      containsKey in interface PropertiesCollection<String>
      Parameters:
      name - the name of the property to check.
      Returns:
      true if the property could be found, false otherwise.