Class RuntimeEnvironment

java.lang.Object
me.legrange.service.RuntimeEnvironment

public final class RuntimeEnvironment extends Object
A utility class that provides access to OS/runtime environment relate information and operations.
  • Method Details

    • isInContainer

      public static boolean isInContainer()
      Detect if the application is running inside a container. This is heuristic based and will need to be expanded for different container framerworks.
      Returns:
      True if we thinkk it is in a container
    • getArch

      public static String getArch()
      Get the CPU architecture.
      Returns:
      The CPU architeture
    • getCores

      public static int getCores()
      Return the number of CPU cores.
      Returns:
      The number of cores
    • isIpv6Supported

      public static boolean isIpv6Supported() throws EnvironmentDetectionException
      Return if IPv6 is supported.
      Returns:
      True if it is
      Throws:
      EnvironmentDetectionException
    • isIpv4Supported

      public static boolean isIpv4Supported() throws EnvironmentDetectionException
      Return if IPv4 is supported.
      Returns:
      True if it is
      Throws:
      EnvironmentDetectionException
    • getApplicationJarName

      public static String getApplicationJarName() throws EnvironmentDetectionException
      Return the path of the JAR file containing the running application.
      Returns:
      The path to the JAR
      Throws:
      EnvironmentDetectionException
    • getTempDir

      public static String getTempDir()
    • getComputerName

      public static String getComputerName()
    • getOsType

      public static RuntimeEnvironment.Type getOsType()
      Apply heuristics to determine the OS type from the os.name system property.
      Returns:
      The OS Type