Is it possible to configure the Genesys Cloud Java SDK to utilize a shared, thread-safe HTTP client with custom connection pooling settings, rather than creating a new client instance per request? I am migrating our org management automation from Python to Java to leverage better concurrency control, and I have noticed that the default PlatformClient initialization seems to create transient HTTP connections. For a high-volume bulk update job processing thousands of user records, this approach leads to significant latency and potential port exhaustion. I want to ensure that the underlying Apache HttpClient or OkHttp instance is reused across multiple threads in my executor service.
Currently, I am initializing the client as follows:
Configuration.setDefault(new Configuration.Builder()
.setAuthMode("oauth")
.setClientId(clientId)
.setClientSecret(clientSecret)
.build());
PlatformClient client = PlatformClient.create();
UsersApi usersApi = client.getUsersApi();
When I run this in a parallel stream with 50 threads, I observe a steady increase in open file descriptors and occasional java.net.SocketException: Connection reset errors when the thread pool is saturated. The documentation for the Java SDK is sparse regarding low-level HTTP client configuration. I need to set specific pool limits, such as maxTotal and defaultMaxPerRoute, to handle the burst traffic efficiently. Does the SDK expose a method to inject a pre-configured HttpClient instance, or should I be bypassing the SDK entirely and using the raw REST API with a custom OkHttp client to manage the pooling manually? I want to avoid reinventing the wheel for authentication and serialization if the SDK supports this natively.