Class SingleIpHttpClient

java.lang.Object
com.github.nhenneaux.resilienthttpclient.monitoredclientpool.SingleIpHttpClient
All Implemented Interfaces:
AutoCloseable

public class SingleIpHttpClient extends Object implements AutoCloseable
  • Constructor Details

    • SingleIpHttpClient

      public SingleIpHttpClient(HttpClient httpClient, InetAddress inetAddress, ServerConfiguration serverConfiguration, ScheduledExecutorService scheduledExecutorService)
      Create a new instance of the client and schedule a task to refresh is healthiness.
      Parameters:
      httpClient - the underlying HTTP client
      inetAddress - the target IP address
      serverConfiguration - the configuration of the server
      scheduledExecutorService - the scheduled executor service to schedule the refresh.
    • SingleIpHttpClient

      public SingleIpHttpClient(HttpClient httpClient, InetAddress inetAddress, ServerConfiguration serverConfiguration)
      Create a new instance and check its health once.
      Parameters:
      httpClient - the underlying HTTP client
      inetAddress - the target IP address
      serverConfiguration - the configuration of the server
  • Method Details

    • isHealthy

      public boolean isHealthy()
      If called and the previous health status was unhealthy, then a new health check is performed.
    • getHttpClient

      public HttpClient getHttpClient()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable