simon-ras commented on code in PR #23480:
URL: https://github.com/apache/camel/pull/23480#discussion_r3290454236


##########
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:
   So, if I wanted to limit to say `50`, then I would have to pass in a profile 
of `maxPoolSize=0` and `maxQueueSize=50` since the default of `maxPoolSize=20` 
would be used otherwise?
   
   I would find it easier to only use `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]

Reply via email to