Package io.dropwizard.health.check.tcp
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
-
-
Constructor Summary
Constructors Constructor Description TcpHealthCheck(@NonNull String host, int port)
TcpHealthCheck(@NonNull String host, int port, Duration connectionTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.codahale.metrics.health.HealthCheck.Result
check()
protected boolean
tcpCheck(String host, int port)
Performs a health check via TCP against an external dependency.
-
-
-
Method Detail
-
check
protected com.codahale.metrics.health.HealthCheck.Result check() throws IOException
- Specified by:
check
in classcom.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 JavaSocket
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
-
-