Class SystemInfo

java.lang.Object
com.linecorp.armeria.common.util.SystemInfo

public final class SystemInfo extends Object
Provides utilities for accessing the information about the current system and process.
  • Method Details

    • javaVersion

      public static int javaVersion()
      Returns the major version of the current Java Virtual Machine.
    • hostname

      public static String hostname()
      Returns the local hostname.
    • jettyAlpnOptionalOrAvailable

      public static boolean jettyAlpnOptionalOrAvailable()
      Whether the environment either supports ALPN natively or includes Jetty ALPN.
    • pid

      public static int pid()
      Returns the current process ID.
      Throws:
      IllegalStateException - if failed to retrieve the current process ID.
    • hasIpV6

      public static boolean hasIpV6()
      Returns true if the system has at least one working IPv6 network interface and the java.net.preferIPv4Stack system property is not enabled.
      See Also:
    • defaultNonLoopbackIpV4Address

      @Nullable public static @Nullable Inet4Address defaultNonLoopbackIpV4Address()
      Returns the non-loopback Inet4Address whose NetworkInterface.getIndex() is the lowest.
      See Also:
    • currentTimeMicros

      public static long currentTimeMicros()
      Returns the number of microseconds since the epoch (00:00:00, 01-Jan-1970, GMT). The precision of the returned value may vary depending on Java version. Currently, Java 9 or above is required for microsecond precision. System.currentTimeMillis() * 1000 is returned on Java 8.
    • osType

      public static OsType osType()
      Returns the operating system for the currently running process.
    • isLinux

      public static boolean isLinux()
      Returns true if the operating system is Linux.