Croway commented on code in PR #23480:
URL: https://github.com/apache/camel/pull/23480#discussion_r3290890287
##########
core/camel-support/src/main/java/org/apache/camel/support/DefaultThreadPoolFactory.java:
##########
@@ -64,6 +66,19 @@ public ExecutorService newCachedThreadPool(ThreadFactory
threadFactory) {
@Override
public ExecutorService newThreadPool(ThreadPoolProfile profile,
ThreadFactory factory) {
+ // Virtual threads: use the policy enum directly from the profile to
avoid reverse-mapping
+ if (profile.getMaxQueueSize() > 0
+ && ThreadPoolFactoryType.from(factory, profile) ==
ThreadPoolFactoryType.VIRTUAL) {
+ ThreadPoolRejectedPolicy policy = profile.getRejectedPolicy();
+ if (policy == null) {
+ policy = ThreadPoolRejectedPolicy.CallerRuns;
+ }
+ return new BoundedExecutorService(
+ ThreadPoolFactoryType.newThreadPerTaskExecutor(factory),
+ profile.getMaxPoolSize() + profile.getMaxQueueSize(),
Review Comment:
good point, sounds reasonable, the previous approach was mimicking the
normal Thread scenario, but in the context of Virtual Thread is just confusing.
I've updated with only `profile.getMaxQueueSize()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]