Package com.lightbend.cinnamon.info
Class RuntimeInformation
- java.lang.Object
-
- com.lightbend.cinnamon.info.RuntimeInformation
-
public class RuntimeInformation extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description RuntimeInformation()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getDefaultApplicationName()
Get the default application name for this JVM.static java.lang.String
getDefaultHostName()
Get the default host name for this JVM.static java.lang.String
getMainClassFromCommand(java.lang.String command)
Get the main class from a command string.static java.lang.String
getMainClassFromEnvironment(java.util.Map<java.lang.String,java.lang.String> env)
Get the main class from environment variables.
-
-
-
Method Detail
-
getDefaultHostName
public static java.lang.String getDefaultHostName()
Get the default host name for this JVM.Returns the local host name or otherwise the local host address. Use the
cinnamon.host
property to set the host name directly.- Returns:
- default host name
-
getDefaultApplicationName
public static java.lang.String getDefaultApplicationName()
Get the default application name for this JVM.A best effort attempt at an application name based on main class, which may not work on all platforms or JVMs. Use the
cinnamon.application
property to set the application name directly.Uses the
sun.java.command
property, or uses theJAVA_MAIN_CLASS
environment variable, or otherwise defaults to the process identifier fromRuntimeMXBean
(usuallypid@hostname
).- Returns:
- default application name
-
getMainClassFromCommand
public static java.lang.String getMainClassFromCommand(java.lang.String command)
Get the main class from a command string.The command may be either a main class and arguments, or a jar file and arguments.
- Parameters:
command
- full command string- Returns:
- main class in the command string, otherwise null
-
getMainClassFromEnvironment
public static java.lang.String getMainClassFromEnvironment(java.util.Map<java.lang.String,java.lang.String> env)
Get the main class from environment variables.Looks for JAVA_MAIN_CLASS variables. If these have a PID suffix, then uses the variable with the highest PID (most recent).
- Parameters:
env
- map of environment variables- Returns:
- main class from the environment, otherwise null
-
-