Class JvmMetrics

java.lang.Object
com.itrsgroup.collection.instr.jvm.JvmMetrics
All Implemented Interfaces:
AutoCloseable

public class JvmMetrics extends Object implements AutoCloseable
Orchestrates the collection of prescribed JVM metrics and reports them via the provided client.

Collection is designed to have minimal impact on the host application - all post-construction exceptions are caught and reported via the provided callback.

Only one instance can be created per JVM. The instance should be created via JvmMetricsBuilder.

  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • clearInstance

      public static void clearInstance()
      Clear the singleton "instantiated" flag for this class.

      The class enforces that only one instance of itself is running in the JVM. This method should generally only be used in unit testing. Note that it does not close the current instance if it exists.