package org.folio.okapi.common;

import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Factory for HttpClient instances to avoid web socket leaks.
 */
public final class HttpClientFactory {
  private static final Map<Vertx, HttpClient> clients = new ConcurrentHashMap<>();

  private HttpClientFactory() {
    throw new UnsupportedOperationException("Utility classes cannot be instantiated");
  }

  /**
   * Get a WebClient, returns the same instance for the same Vertx instance.
   *
   * <p>The webClientOptions parameter is only used when creating the WebClient,
   * the options of an existing WebClient are not changed.
   */
  public static HttpClient getHttpClient(Vertx vertx, HttpClientOptions httpClientOptions) {
    return clients.computeIfAbsent(vertx, x -> vertx.createHttpClient(httpClientOptions));
  }

  /**
   * Get a WebClient, returns the same instance for the same Vertx instance.
   *
   * <p>It doesn't reset WebClientOptions when returning an existing WebClient.
   */
  public static HttpClient getHttpClient(Vertx vertx) {
    return getHttpClient(vertx, new HttpClientOptions());
  }
}

@@ -534,35 +534,36 @@
  /**%0A   * Get a 
-Web
+Http
 Client, returns 
@@ -626,19 +626,20 @@
  %3Cp%3EThe 
-web
+http
 ClientOp
@@ -685,19 +685,20 @@
 ing the 
-Web
+Http
 Client,%0A
@@ -725,27 +725,28 @@
 an existing 
-Web
+Http
 Client are n
@@ -969,19 +969,20 @@
 * Get a 
-Web
+Http
 Client, 
@@ -1066,19 +1066,20 @@
 t reset 
-Web
+Http
 ClientOp
@@ -1115,11 +1115,12 @@
 ing 
-Web
+Http
 Clie

Fix javadoc for HttpClientFactory methods (#1241)