Java SDK HttpClient connection pool exhaustion and custom pooling strategy

We are running into a wall with the Java Platform SDK. The default Apache HttpClient that comes bundled seems to max out connections very quickly during peak hours. We see thread contention errors when trying to make bulk API calls to update user profiles.

The error looks like this:

java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask rejected by java.util.concurrent.ThreadPoolExecutor@... [Terminated]

Or sometimes just a timeout waiting for a connection from the pool. We tried to inject a custom PoolingHttpClientConnectionManager into the ApiClient builder, but the SDK doesn’t seem to expose a clean way to do this without hacking the internals.

Here is what we tried:

PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
connManager.setMaxTotal(200);
connManager.setDefaultMaxPerRoute(50);

CloseableHttpClient httpClient = HttpClients.custom()
 .setConnectionManager(connManager)
 .build();

// How do I pass this httpClient to the Genesys Cloud ApiClient?
// The builder only accepts apiKey and apiSecret...

Is there a way to inject a custom HttpClient instance into the ApiClient configuration? Or should we be managing the connections outside of the SDK entirely? We need a thread-safe way to handle high-volume requests without the default pool choking. Any pointers on how to configure the underlying HTTP client properly would be great.