I have requirement to call REST API from an OSGI service which is running in K8 pods. For this I am thinking to use Java Async way by using Executor service.
But I am not sure how my code will work in the Kubernetes Cluster when I use my own Threadpool size
ExecutorService executorService = Executors.newFixedThreadPool(10)
HttpClient.newBuilder()
.executor(executorService)
.build()
.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApplyAsync(new Function<HttpResponse<String>, GraphQlResponse>() {
public GraphQlResponse apply(HttpResponse<String> response) {
// some code
}
}, executorService);
At the moment, I do not know the resource management configuration of PODs.
Can it cause performance issue?