Class TcpHealthCheck


  • public class TcpHealthCheck
    extends com.codahale.metrics.health.HealthCheck
    • 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 Detail

      • TcpHealthCheck

        public TcpHealthCheck​(@NonNull String host,
                              int port)
      • TcpHealthCheck

        public TcpHealthCheck​(@NonNull String host,
                              int port,
                              Duration connectionTimeout)
    • Method Detail

      • check

        protected com.codahale.metrics.health.HealthCheck.Result check()
                                                                throws IOException
        Specified by:
        check in class com.codahale.metrics.health.HealthCheck
        Throws:
        IOException
      • tcpCheck

        protected boolean tcpCheck​(String host,
                                   int port)
                            throws IOException
        Performs a health check via TCP against an external dependency. By default uses the Java Socket API, but can be overridden to allow for different behavior.
        Parameters:
        host - the host to check.
        port - the port to check.
        Returns:
        whether the check was successful or not.
        Throws:
        IOException