com.neeve.ci
Class XRuntime

java.lang.Object
  extended by com.neeve.ci.XRuntime

public class XRuntime
extends Object

Provider runtime information of an X Platform installation.


Nested Class Summary
static class XRuntime.Optimization
          Enumerates global optimizations
 
Field Summary
static String defaultAppGroup
          The default application group.
static String defaultAppName
          The default application name.
 
Constructor Summary
XRuntime()
           
 
Method Summary
static boolean conserveCPU()
          Gets whether or not an attempt will be made to conserve CPU (nv.conservecpu=true is set).
static com.lmax.disruptor.WaitStrategy createWaitStrategy(String configuredWaitStrategy, boolean optimize)
          Constructs a Disruptor WaitStrategy.
static String getAppGroup()
          Get the Neeve application group.
static String getAppName()
          Get the Neeve application name.
static String getBinDirectory()
          Get the runtime bin directory
static String getConfigDirectory()
          Get the runtime configuration directory.
static String getDataDirectory()
          Get the runtime data directory and create if absent.
static String getDataDirectory(boolean createIfAbsent)
          Get the runtime data directory.
static String getFullAppName()
          Get the fully qualifies Neeve application name.
static String getJavaLibDirectory()
          Get the java libs directory
static com.neeve.license.License getLicense()
          Gets the validated license for the X Runtime.
static String getLicenseDirectory()
          Get the runtime license directory
static String getLocalHostAddress()
          Alias for UtlEnv.getLocalHostAddress()
static String getLocalHostAddressForDisplay(String defaultValue)
          Alias for UtlEnv.getLocalHostAddressForDisplay(String)
static String getLocalHostName()
          Alias for UtlEnv.getLocalHostName()
static String getLocalHostNameForDisplay(String defaultValue)
          Alias for UtlEnv.getLocalHostNameForDisplay(String)
static String getLogsDirectory()
          Get the runtime trace log directory and create if absent.
static String getLogsDirectory(boolean createIfAbsent)
          Get the runtime trace log directory.
static String getPid()
          Get the process pid This method returns the process id of the current process
static String getPlatform()
          Get the runtime platform.
static Properties getProps()
          Get the Neeve runtime property set.
static String getRootDirectory()
          Get the runtime root directory.
static String getUnmanagedJavaLibDirectory()
          Get the java unmanaged lib directory
static Object getValue(String name)
          Get the value of a property from the environment props.
static boolean getValue(String name, boolean defValue)
          Convenience method to return an environment property value as a boolean value
static byte getValue(String name, byte defValue)
          Convenience method to return a property from the environment as a byte value.
static double getValue(String name, double defValue)
          Convenience method to return a property from the environment as a double value.
static float getValue(String name, float defValue)
          Convenience method to return a property from the environment as a float value.
static int getValue(String name, int defValue)
          Convenience method to return a property from the environment as a int value.
static long getValue(String name, long defValue)
          Convenience method to return a property from the environment as a int value.
static short getValue(String name, short defValue)
          Convenience method to return a property from the environment as a float value.
static String getValue(String name, String defValue)
          Convenience method to return a property value as a String value *
static boolean isWindowsPlatform()
          Get whether the an X Platform's runtime is installed on windows.
static boolean optimizeForLatency()
          Get whether system is globally configured to optimize for latency (nv.optimizefor=latency is set).
static boolean optimizeForThroughput()
          Get whether system is globally configured to optimize for throughput (nv.optimizefor=throughput is set).
static boolean optimizeMemoryUsage()
          Gets whether or not memory usage optimizations should be enabled.
static void setAppGroup(String val)
          Set the Neeve application group.
static void setAppName(String val)
          Set the Neeve application name.
static void setOptimization(XRuntime.Optimization val)
          Set the global optimization to use
static void updateProps(Properties val)
          Update the Neeve runtime property set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultAppName

public static final String defaultAppName
The default application name.

The value in this constant is returned by getAppName() in case the user has not specified the application name via the nv.app.name runtime property or the setAppName(java.lang.String) method.

See Also:
Constant Field Values

defaultAppGroup

public static final String defaultAppGroup
The default application group.

The value in this constant is returned by getAppGroup() in case the user has not specified the application name via the nv.app.group runtime property or the setAppGroup(java.lang.String) method.

See Also:
Constant Field Values
Constructor Detail

XRuntime

public XRuntime()
Method Detail

getLicense

public static com.neeve.license.License getLicense()
Gets the validated license for the X Runtime.

Returns:
The X Runtime license or null if no license was found.

setOptimization

public static final void setOptimization(XRuntime.Optimization val)
Set the global optimization to use


getRootDirectory

public static final String getRootDirectory()
Get the runtime root directory.

This method returns the runtime root directory. The runtime root directory is stored in the NVROOT system property. In case the property is not set, the current directory ('.') is returned as the runtime root.

Threading:
This method is safe for concurrent access by multiple threads.

getBinDirectory

public static final String getBinDirectory()
Get the runtime bin directory

Threading:
This method is safe for concurrent access by multiple threads.

getConfigDirectory

public static final String getConfigDirectory()
Get the runtime configuration directory.

Threading:
This method is safe for concurrent access by multiple threads.

getLicenseDirectory

public static final String getLicenseDirectory()
Get the runtime license directory

Threading:
This method is safe for concurrent access by multiple threads.

getJavaLibDirectory

public static final String getJavaLibDirectory()
Get the java libs directory

Threading:
This method is safe for concurrent access by multiple threads.

getUnmanagedJavaLibDirectory

public static final String getUnmanagedJavaLibDirectory()
Get the java unmanaged lib directory

Threading:
This method is safe for concurrent access by multiple threads.

getDataDirectory

public static final String getDataDirectory(boolean createIfAbsent)
Get the runtime data directory.

Parameters:
createIfAbsent - Causes the directory to be created if absent,
Threading:
This method is safe for concurrent access by multiple threads.

getDataDirectory

public static final String getDataDirectory()
Get the runtime data directory and create if absent.

Threading:
This method is safe for concurrent access by multiple threads.

This method is equivalent to the invoking getDataDirectory(true)


getLogsDirectory

public static final String getLogsDirectory(boolean createIfAbsent)
Get the runtime trace log directory.

Parameters:
createIfAbsent - Causes the directory to be created if absent.
Threading:
This method is safe for concurrent access by multiple threads.

getLogsDirectory

public static final String getLogsDirectory()
Get the runtime trace log directory and create if absent.

Threading:
This method is safe for concurrent access by multiple threads.

This method is equivalent to the invoking getLogsDirectory(true)


getLocalHostNameForDisplay

public static final String getLocalHostNameForDisplay(String defaultValue)
Alias for UtlEnv.getLocalHostNameForDisplay(String)


getLocalHostName

public static final String getLocalHostName()
                                     throws UnknownHostException
Alias for UtlEnv.getLocalHostName()

Throws:
UnknownHostException

getLocalHostAddressForDisplay

public static final String getLocalHostAddressForDisplay(String defaultValue)
Alias for UtlEnv.getLocalHostAddressForDisplay(String)


getLocalHostAddress

public static final String getLocalHostAddress()
                                        throws UnknownHostException
Alias for UtlEnv.getLocalHostAddress()

Throws:
UnknownHostException

getPid

public static final String getPid()
Get the process pid

This method returns the process id of the current process

Threading:
This method is safe for concurrent access by multiple threads.

setAppGroup

public static final void setAppGroup(String val)
Set the Neeve application group.

Parameters:
val - The group name to be set.

This method sets the Neeve application group. A Neeve application group partitions out participating Neeve applications into non-intersecting groups. Applications in different groups cannot communicate with each other.

Threading:
This method is safe for concurrent access by multiple threads

getAppGroup

public static final String getAppGroup()
Get the Neeve application group.

Returns:
The application group.

This method returns the Neeve application group. The application group is initialized on startup from the nv.app.group application property and can be overriden via the setAppGroup(java.lang.String) method. The default value for the application name is defaultAppGroup.

See Also:
setAppGroup(java.lang.String)
Threading:
This method is safe for concurrent access by multiple threads

setAppName

public static final void setAppName(String val)
Set the Neeve application name.

This method sets the Neeve application name. A Neeve application is a set of user classes managed by the same classloader that utilize the Neeve runtime to perform their function. The application name is a human readable name primarily for tracing and debugging purposes used to identify such a set of classes.

Parameters:
val - The name to be set.
Threading:
This method is safe for concurrent access by multiple threads

getAppName

public static final String getAppName()
Get the Neeve application name.

Returns:
The application name.

This method returns the Neeve application name. The application name is initialized on startup from the nv.app.name application property and can be overriden via the setAppName(java.lang.String) method. The default value for the application name is defaultAppName.

See Also:
setAppName(java.lang.String)
Threading:
This method is safe for concurrent access by multiple threads

getFullAppName

public static final String getFullAppName()
Get the fully qualifies Neeve application name.

Returns:
The fully qualifies name.

This method concatenates the application name and group to produce the fully qualified application name. The format of the fully qualified name is [group]:[name]

See Also:
getAppName(), getAppGroup()
Threading:
This method is safe for concurrent access by multiple threads

updateProps

public static final void updateProps(Properties val)
Update the Neeve runtime property set.

Several Neeve components support initialization and configuration using properties in the runtime property set. The application property set is maintained by this class. Upon startup, it is initialized with the Java runtime system property set and updated with properties specified in the property file referenced by the system property 'nv.app.propfile' if present. This method allows the user to further update the property set in case the user wishes to override the property values set using the above described manner.

This method will cause the Neeve application name to be reloaded using the 'nv.app.name' property in the new property set. The application name remains unchanged in case the property is absent from the new property set.

Parameters:
val - The properties to update the property set with.
Threading:
This method is safe for concurrent access by multiple threads

getProps

public static final Properties getProps()
Get the Neeve runtime property set.

Returns:
The runtime property set .

This method gets the Neeve runtime property set.

See Also:
updateProps(java.util.Properties)
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static Object getValue(String name)
Get the value of a property from the environment props.

Parameters:
name - The property name
Returns:
Returns the property value
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static boolean getValue(String name,
                               boolean defValue)
Convenience method to return an environment property value as a boolean value

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a boolean value.
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static double getValue(String name,
                              double defValue)
Convenience method to return a property from the environment as a double value.

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a numeric value.
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static float getValue(String name,
                             float defValue)
Convenience method to return a property from the environment as a float value.

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a float value.
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static long getValue(String name,
                            long defValue)
Convenience method to return a property from the environment as a int value.

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a long value.
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static int getValue(String name,
                           int defValue)
Convenience method to return a property from the environment as a int value.

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a int value.
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static short getValue(String name,
                             short defValue)
Convenience method to return a property from the environment as a float value.

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a short value.
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static byte getValue(String name,
                            byte defValue)
Convenience method to return a property from the environment as a byte value.

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a byte value.
Threading:
This method is safe for concurrent access by multiple threads

getValue

public static String getValue(String name,
                              String defValue)
Convenience method to return a property value as a String value *

Parameters:
name - The property name
defValue - The default property value to return in case the property could not be found in the property table.
Returns:
Returns the property value as a String value.

This method is a convenience method that returns a property value as a string value. It uses getValue(java.lang.String) to retrieve the property value. The default value is returned in case the no property with the provided name exists in the property table.

Threading:
This method is safe for concurrent access by multiple threads

getPlatform

public static final String getPlatform()
Get the runtime platform.

This method returns the runtime platform. The runtime platform is stored in the NVPLATFORM system property. A null value is returned in case the platform is not set.

Threading:
This method is safe for concurrent access by multiple threads.

isWindowsPlatform

public static final boolean isWindowsPlatform()
Get whether the an X Platform's runtime is installed on windows.

Threading:
This method is safe for concurrent access by multiple threads.

createWaitStrategy

public static final com.lmax.disruptor.WaitStrategy createWaitStrategy(String configuredWaitStrategy,
                                                                       boolean optimize)
                                                                throws IllegalArgumentException
Constructs a Disruptor WaitStrategy.

This call allows the platform to optimize disruptor wait strategy create based on the XRuntime.Optimization currently set for the runtime by 'nv.optimizefor' when the passed in value for optimize is true:

Parameters:
configuredWaitStrategy - The configured wait strategy which will be returned if the wait strategy isn't optimized. Must be one of Blocking, Sleeping, Yielding or BusySpin.
optimize - If true will optimize the configured wait strategy according to the 'nv.optimizefor' environment variable unless nv.disablewaitstrategyoptimizations=true has been set in which case such optimizations are disabled.
Returns:
A WaitStrategy for the given configuredWaitStrategy.
Throws:
IllegalArgumentException - if the configuredWaitStrategy is not one of Blocking, Sleeping, Yielding or BusySpin.

optimizeForLatency

public static final boolean optimizeForLatency()
Get whether system is globally configured to optimize for latency (nv.optimizefor=latency is set).


optimizeForThroughput

public static final boolean optimizeForThroughput()
Get whether system is globally configured to optimize for throughput (nv.optimizefor=throughput is set).


optimizeMemoryUsage

public static final boolean optimizeMemoryUsage()
Gets whether or not memory usage optimizations should be enabled. Such optimizations typically come at the cost of throughput and latency.

Returns:
Whether or not to optimize memory usage.

conserveCPU

public static final boolean conserveCPU()
Gets whether or not an attempt will be made to conserve CPU (nv.conservecpu=true is set).

When set this instructs the runtime to try to conserve CPU resources by avoiding spinning.

Returns:
Whether or not to conserve CPU.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.