Class HttpHealthIndicator.Builder

java.lang.Object
com.helixframework.api.health.HttpHealthIndicator.Builder
Enclosing class:
HttpHealthIndicator

public static final class HttpHealthIndicator.Builder extends Object
The Builder class is a utility class used to create instances of HttpHealthIndicator.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • client

      public HttpHealthIndicator.Builder client(okhttp3.OkHttpClient client)
      Optional. Sets the OkHttpClient used for making HTTP requests in the HttpHealthIndicator.
      Parameters:
      client - the OkHttpClient to set
      Returns:
      the Builder object
    • request

      public HttpHealthIndicator.Builder request(okhttp3.Request request)
      Sets the request to be used for making the HTTP health check.
      Parameters:
      request - the request to be used
      Returns:
      the Builder object
      Throws:
      IllegalArgumentException - if the request is null
    • healthCheck

      public HttpHealthIndicator.Builder healthCheck(Function<okhttp3.Response,org.springframework.boot.actuate.health.Health> healthCheck)
      Optional. Set the health check function for the HttpHealthIndicator.
      Parameters:
      healthCheck - the health check function to set
      Returns:
      the Builder object
    • maxFailures

      public HttpHealthIndicator.Builder maxFailures(int maxFailures)
      Optional. Sets the maximum number of consecutive failures allowed in the HttpHealthIndicator.

      If the provided number of failures is negative, the default maximum number of failures will be used.

      Parameters:
      maxFailures - the maximum number of consecutive failures allowed
      Returns:
      the Builder object
    • delay

      public HttpHealthIndicator.Builder delay(Duration delay)
      Optional. Sets the delay for performing periodic health checks in the HttpHealthIndicator.

      If the provided delay is null or negative, the default update delay will be used.

      Parameters:
      delay - the delay for performing health checks
      Returns:
      the Builder object
    • period

      public HttpHealthIndicator.Builder period(Duration period)
      Optional. Sets the period for performing periodic health checks in the HttpHealthIndicator.

      If the provided period is null or negative, the default update period will be used.

      Parameters:
      period - the period for performing health checks
      Returns:
      the Builder object
    • build

      public HttpHealthIndicator build()
      Builds and returns a new instance of HttpHealthIndicator.
      Returns:
      a new HttpHealthIndicator instance