Class TimedHealthCheck


  • public class TimedHealthCheck
    extends com.codahale.metrics.health.HealthCheck
    Health Check wrapper that will timeout 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
    • 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.
    • Field Detail

      • HEALTH_CHECK_EXECUTOR

        public static final ExecutorService HEALTH_CHECK_EXECUTOR
    • Constructor Detail

      • 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 Detail

      • check

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