Class HealthCheckRegistry

java.lang.Object
com.codahale.metrics.health.HealthCheckRegistry

public class HealthCheckRegistry extends Object
A registry for health checks.
  • Field Details

  • Constructor Details

  • Method Details

    • register

      public void register(String name, HealthCheck healthCheck)
      Registers an application HealthCheck.
      Parameters:
      name - the name of the health check
      healthCheck - the HealthCheck instance
    • unregister

      public void unregister(String name)
      Unregisters the application HealthCheck with the given name.
      Parameters:
      name - the name of the HealthCheck instance
    • getNames

      public SortedSet<String> getNames()
      Returns a set of the names of all registered health checks.
      Returns:
      the names of all registered health checks
    • runHealthCheck

      public HealthCheck.Result runHealthCheck(String name) throws NoSuchElementException
      Runs the health check with the given name.
      Parameters:
      name - the health check's name
      Returns:
      the result of the health check
      Throws:
      NoSuchElementException - if there is no health check with the given name
    • runHealthChecks

      public SortedMap<String,HealthCheck.Result> runHealthChecks()
      Runs the registered health checks and returns a map of the results.
      Returns:
      a map of the health check results
    • runHealthChecks

      public SortedMap<String,HealthCheck.Result> runHealthChecks(ExecutorService executor)
      Runs the registered health checks in parallel and returns a map of the results.
      Returns:
      a map of the health check results