Package io.smallrye.health.checks
Class SocketHealthCheck
- java.lang.Object
-
- io.smallrye.health.checks.SocketHealthCheck
-
- All Implemented Interfaces:
org.eclipse.microprofile.health.HealthCheck
public class SocketHealthCheck extends Object implements org.eclipse.microprofile.health.HealthCheck
Health check implementation to check if host is reachable using a socket.@Produces @ApplicationScoped @Liveness HealthCheck check1() { return new SocketHealthCheck("192.168.0.2", 5432); }- See Also:
Socket
-
-
Constructor Summary
Constructors Constructor Description SocketHealthCheck(String host, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.microprofile.health.HealthCheckResponsecall()SocketHealthCheckname(String name)Sets the name of the health check.SocketHealthChecktimeout(int timeout)Sets timeout in millis.
-
-
-
Constructor Detail
-
SocketHealthCheck
public SocketHealthCheck(String host, int port)
-
-
Method Detail
-
call
public org.eclipse.microprofile.health.HealthCheckResponse call()
- Specified by:
callin interfaceorg.eclipse.microprofile.health.HealthCheck
-
name
public SocketHealthCheck name(String name)
Sets the name of the health check.- Parameters:
name- of health check.- Returns:
- SocketHealthCheck instance.
-
timeout
public SocketHealthCheck timeout(int timeout)
Sets timeout in millis.- Parameters:
timeout- in millis.- Returns:
- SocketHealthCheck instance.
-
-