Class ExternalServiceHealthCheck
java.lang.Object
com.codahale.metrics.health.HealthCheck
org.sdase.commons.server.healthcheck.helper.ExternalServiceHealthCheck
@ExternalHealthCheck
public class ExternalServiceHealthCheck
extends com.codahale.metrics.health.HealthCheck
Default health check for checking if an external URL returns status code 2xx when invoking a
simple HTTP GET
-
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
ConstructorsConstructorDescriptionExternalServiceHealthCheck
(String url, int timeoutMillis) ExternalServiceHealthCheck
(String url, int timeoutMillis, OpenConnectionFunction openConnection) ExternalServiceHealthCheck
(String requestMethod, String url, int timeoutMillis) ExternalServiceHealthCheck
(String requestMethod, String url, int timeoutMillis, OpenConnectionFunction openConnection) -
Method Summary
Methods inherited from class com.codahale.metrics.health.HealthCheck
clock, execute
-
Constructor Details
-
ExternalServiceHealthCheck
- Parameters:
url
- the URL that is requested usingGET
timeoutMillis
- the timeout for establishing the connection and waiting for data
-
ExternalServiceHealthCheck
- Parameters:
requestMethod
- the method to use for the check request,GET
andHEAD
are allowed valuesurl
- the URL that is requested usingGET
timeoutMillis
- the timeout for establishing the connection and waiting for data
-
ExternalServiceHealthCheck
public ExternalServiceHealthCheck(String url, int timeoutMillis, OpenConnectionFunction openConnection) - Parameters:
url
- the URL that is requested usingGET
timeoutMillis
- the timeout for establishing the connection and waiting for dataopenConnection
- provider of theHttpURLConnection
-
ExternalServiceHealthCheck
public ExternalServiceHealthCheck(String requestMethod, String url, int timeoutMillis, OpenConnectionFunction openConnection) - Parameters:
requestMethod
- the method to use for the check request,GET
andHEAD
are allowed valuesurl
- the URL that is requested usingGET
timeoutMillis
- the timeout for establishing the connection and waiting for dataopenConnection
- provider of theHttpURLConnection
-
-
Method Details
-
check
- Specified by:
check
in classcom.codahale.metrics.health.HealthCheck
- Throws:
Exception
-