Package org.jppf.management
Class JPPFSystemInformation
java.lang.Object
org.jppf.management.JPPFSystemInformation
- All Implemented Interfaces:
Serializable,PropertiesCollection<String>
This class encapsulates the system information for a node.
It includes:
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 Summary
ConstructorsConstructorDescriptionJPPFSystemInformation(TypedProperties jppfConfig, String uuid, boolean local, boolean resolveInetAddressesNow) Initialize this system information object with the specified uuid.JPPFSystemInformation(TypedProperties jppfConfig, String uuid, boolean local, boolean resolveInetAddressesNow, JPPFStatistics stats) Initialize this system information object with the specified uuid. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperties(String key, TypedProperties properties) Add the specified properties with the specified keys.booleancontainsKey(String name) Determine whether this properties collection contains a property witht he specified key.getEnv()Get the map holding the environment variables.getJppf()Get the map holding the JPPF configuration properties.Get the map of the network configuration.getOS()Get the properties object holding the operating system information.getProperties(String key) Add the specified properties with the specified key.Get all the properties as an array.getProperty(String name) Get the value of the property with the specified name.Get the map holding the runtime information.getStats()Get the properties object holding the JPPF server statistics, listed as constants inJPPFStatisticsHelper.Get the map holding the host storage information.Get the map holding the system properties.getUuid()Get the properties object holding the JPPF uuid and version information.HostIP[]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.HostIP[]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.populate()Populate this system information object.toString()
-
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-trueif the JPPF component is local (local node or local client executor),falseotherwise.resolveInetAddressesNow- iftrue, then name resolution forInetAddresses 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-trueif the JPPF component is local (local node or local client executor),falseotherwise.resolveInetAddressesNow- iftrue, then name resolution forInetAddresses 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
Get the map holding the system properties.- Returns:
- a
TypedPropertiesinstance. - See Also:
-
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
RuntimeAPIs.- Returns:
- a
TypedPropertiesinstance. - See Also:
-
getEnv
Get the map holding the environment variables.- Returns:
- a
TypedPropertiesinstance. - See Also:
-
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
TypedPropertiesinstance. - See Also:
-
getJppf
Get the map holding the JPPF configuration properties.- Returns:
- a
TypedPropertiesinstance. - See Also:
-
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
- Returns:
- a
TypedPropertiesinstance. - See Also:
-
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
TypedPropertieswrapper for the uuid and version information of the corresponding JPPF component.
-
getStats
Get the properties object holding the JPPF server statistics, listed as constants inJPPFStatisticsHelper.- Returns:
- a
TypedPropertieswrapper for the server statistics; for a node this will return an empty set of properties.
-
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
TypedPropertieswrapper for the operating system information of the corresponding JPPF component.
-
getPropertiesArray
Get all the properties as an array.- Specified by:
getPropertiesArrayin interfacePropertiesCollection<String>- Returns:
- an array of all the sets of properties.
-
addProperties
Description copied from interface:PropertiesCollectionAdd the specified properties with the specified keys.- Specified by:
addPropertiesin interfacePropertiesCollection<String>- Parameters:
key- the key to use.properties- the properties to add.
-
getProperties
Description copied from interface:PropertiesCollectionAdd the specified properties with the specified key.- Specified by:
getPropertiesin interfacePropertiesCollection<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
Populate this system information object.- Returns:
- this
JPPFSystemInformationobject.
-
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
HostIPinstances.
-
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
HostIPinstances.
-
toString
-
getProperty
Description copied from interface:PropertiesCollectionGet the value of the property with the specified name.- Specified by:
getPropertyin interfacePropertiesCollection<String>- Parameters:
name- the name of the property to find.- Returns:
- the proerty value, or
nullif the property could not be found.
-
containsKey
Description copied from interface:PropertiesCollectionDetermine whether this properties collection contains a property witht he specified key.- Specified by:
containsKeyin interfacePropertiesCollection<String>- Parameters:
name- the name of the property to check.- Returns:
trueif the property could be found,falseotherwise.
-