Class TcpHealthCheck

java.lang.Object
com.codahale.metrics.health.HealthCheck
io.dropwizard.health.check.tcp.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 Summary

    Constructors
    Constructor
    Description
    TcpHealthCheck(@NonNull String host, int port)
     
    TcpHealthCheck(@NonNull String host, int port, Duration connectionTimeout)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.codahale.metrics.health.HealthCheck.Result
     
    protected boolean
    tcpCheck(String host, int port)
    Performs a health check via TCP against an external dependency.

    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
  • Constructor Details

    • TcpHealthCheck

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

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

    • 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