Class InetAddressHealthCheck

  • All Implemented Interfaces:
    org.eclipse.microprofile.health.HealthCheck

    public class InetAddressHealthCheck
    extends Object
    implements org.eclipse.microprofile.health.HealthCheck
    Health check implementation to check if host is reachable using java.net.InetAddress.isReachable method.
     
     @Produces
     @ApplicationScoped
     @Liveness
     HealthCheck check1() {
         return new InetAddressHealthCheck("service.com");
     }
     
     
    See Also:
    InetAddress
    • Constructor Detail

      • InetAddressHealthCheck

        public InetAddressHealthCheck​(String host)
    • Method Detail

      • call

        public org.eclipse.microprofile.health.HealthCheckResponse call()
        Specified by:
        call in interface org.eclipse.microprofile.health.HealthCheck
      • timeout

        public InetAddressHealthCheck timeout​(int timeout)
        Sets timeout in millis.
        Parameters:
        timeout - in millis.
        Returns:
        InetAddressHealthCheck instance.
      • name

        public InetAddressHealthCheck name​(String name)
        Sets the name of the health check.
        Parameters:
        name - of health check.
        Returns:
        InetAddressHealthCheck instance.