-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hey.
We're evaluating the usage of Virtual Threads with Executors.newVirtualThreadPerTaskExecutor();
.
I've noticed that there's an inconsistency in the usage of ExecutorService executor
in CtOkHttp4Client
:
public CtOkHttp4Client(final ExecutorService executor) {
super(executor);
okHttpClient = clientBuilder.get().dispatcher(createDispatcher(executor, MAX_REQUESTS, MAX_REQUESTS)).build();
}
public CtOkHttp4Client(final ExecutorService executor, final BuilderOptions options) {
super(executor);
okHttpClient = options.plus(clientBuilder.get().dispatcher(createDispatcher(MAX_REQUESTS, MAX_REQUESTS)))
.build();
}
public CtOkHttp4Client(final ExecutorService executor, final int maxRequests, final int maxRequestsPerHost) {
super(executor);
okHttpClient = clientBuilder.get()
.dispatcher(createDispatcher(executor, maxRequests, maxRequestsPerHost))
.build();
}
public CtOkHttp4Client(final ExecutorService executor, final int maxRequests, final int maxRequestsPerHost,
final BuilderOptions options) {
super(executor);
okHttpClient = options
.plus(clientBuilder.get().dispatcher(createDispatcher(executor, maxRequests, maxRequestsPerHost)))
.build();
}
The second constructor doesn't reuse the passed executorService
when creating the dispatcher, while all others that get the same argument do.
It just so happens that this one would be the ideal one for us 🤠.
Is there a reason for this, or is it an oversight?
Besides this, any thoughts or recommendations on using the Virtual Threads executor with the SDK?
Maybe you've already done experimenting on your end? Is the SDK prone to Thread Pinning?
Thanks.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request