Class GlobalAsyncHttpClient


  • public class GlobalAsyncHttpClient
    extends Object
    A singleton manager for an asynchronous HTTP client using Apache HttpAsyncClient. This class implements a reference-counting mechanism to manage the lifecycle of the shared HTTP client. The client is automatically initialized on first use and shut down when no references remain.
    • Method Detail

      • getClient

        public static org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient getClient()
        Gets the shared HTTP client instance, creating it if necessary. Increments the reference count for the client.
        Returns:
        A shared CloseableHttpAsyncClient instance
      • releaseClient

        public static void releaseClient()
        Decrements the reference count for the shared HTTP client. When the reference count reaches zero, the client is automatically shut down.