Class TimedHealthCheck

java.lang.Object
com.codahale.metrics.health.HealthCheck
org.kiwiproject.dropwizard.metrics.health.TimedHealthCheck

public class TimedHealthCheck extends com.codahale.metrics.health.HealthCheck
Health Check wrapper that will time out after a set period of time.

This is mainly to protect the health checks from blocking forever.

  • Nested Class Summary

    Nested classes/interfaces inherited from class com.codahale.metrics.health.HealthCheck

    com.codahale.metrics.health.HealthCheck.Result, com.codahale.metrics.health.HealthCheck.ResultBuilder
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ExecutorService
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TimedHealthCheck(com.codahale.metrics.health.HealthCheck delegate)
    Creates a new TimedHealthCheck with the given delegate HealthCheck and the default timeout (5 seconds).
    TimedHealthCheck(com.codahale.metrics.health.HealthCheck delegate, io.dropwizard.util.Duration timeout)
    Creates a new TimedHealthCheck with the given (delegate HealthCheck and the given timeout.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.codahale.metrics.health.HealthCheck.Result
     

    Methods inherited from class com.codahale.metrics.health.HealthCheck

    clock, execute

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HEALTH_CHECK_EXECUTOR

      public static final ExecutorService HEALTH_CHECK_EXECUTOR
  • Constructor Details

    • TimedHealthCheck

      public TimedHealthCheck(com.codahale.metrics.health.HealthCheck delegate)
      Creates a new TimedHealthCheck with the given delegate HealthCheck and the default timeout (5 seconds).
      Parameters:
      delegate - the target health check
    • TimedHealthCheck

      public TimedHealthCheck(com.codahale.metrics.health.HealthCheck delegate, io.dropwizard.util.Duration timeout)
      Creates a new TimedHealthCheck with the given (delegate HealthCheck and the given timeout.
      Parameters:
      delegate - the target health check
      timeout - the timeout to use
  • Method Details

    • check

      protected com.codahale.metrics.health.HealthCheck.Result check()
      Specified by:
      check in class com.codahale.metrics.health.HealthCheck