You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by kl...@apache.org on 2022/08/22 15:21:35 UTC

[camel] branch main updated: CAMEL-18420: adapt CamelParallelExecutionStrategy for Junit 5.9.0 (#8203)

This is an automated email from the ASF dual-hosted git repository.

klease pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new dbb700f1579 CAMEL-18420: adapt CamelParallelExecutionStrategy for Junit 5.9.0 (#8203)
dbb700f1579 is described below

commit dbb700f1579acd4dd6e24b7a830a353c9291e27b
Author: klease <38...@users.noreply.github.com>
AuthorDate: Mon Aug 22 17:21:28 2022 +0200

    CAMEL-18420: adapt CamelParallelExecutionStrategy for Junit 5.9.0 (#8203)
    
    Use 1024 as maximum pool size and add a saturate predicate.
---
 .../org/apache/camel/CamelParallelExecutionStrategy.java    | 13 +++++++++++++
 .../camel-core/src/test/resources/junit-platform.properties |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/CamelParallelExecutionStrategy.java b/core/camel-core/src/test/java/org/apache/camel/CamelParallelExecutionStrategy.java
index 5f2e7800e44..8dd28da24c5 100644
--- a/core/camel-core/src/test/java/org/apache/camel/CamelParallelExecutionStrategy.java
+++ b/core/camel-core/src/test/java/org/apache/camel/CamelParallelExecutionStrategy.java
@@ -17,6 +17,8 @@
 package org.apache.camel;
 
 import java.util.Optional;
+import java.util.concurrent.ForkJoinPool;
+import java.util.function.Predicate;
 
 import org.junit.platform.engine.ConfigurationParameters;
 import org.junit.platform.engine.support.hierarchical.ParallelExecutionConfiguration;
@@ -66,6 +68,17 @@ public class CamelParallelExecutionStrategy implements ParallelExecutionConfigur
             return 30;
         }
 
+        @Override
+        public Predicate<? super ForkJoinPool> getSaturatePredicate() {
+            return (ForkJoinPool pool) -> {
+                LOG.info("Junit ForkJoinPool saturated: running threads={}, pool size={}, queued tasks={}",
+                        pool.getRunningThreadCount(),
+                        pool.getPoolSize(),
+                        pool.getQueuedTaskCount());
+                return true;
+            };
+        }
+
     }
 
     @Override
diff --git a/core/camel-core/src/test/resources/junit-platform.properties b/core/camel-core/src/test/resources/junit-platform.properties
index 1f4ce5e3177..808642f9f67 100644
--- a/core/camel-core/src/test/resources/junit-platform.properties
+++ b/core/camel-core/src/test/resources/junit-platform.properties
@@ -20,5 +20,5 @@ junit.jupiter.execution.parallel.mode.default = same_thread
 junit.jupiter.execution.parallel.mode.classes.default = concurrent
 junit.jupiter.execution.parallel.config.strategy = custom
 junit.jupiter.execution.parallel.config.custom.parallelism = 4
-junit.jupiter.execution.parallel.config.custom.maxPoolSize = 4096
+junit.jupiter.execution.parallel.config.custom.maxPoolSize = 1024
 junit.jupiter.execution.parallel.config.custom.class=org.apache.camel.CamelParallelExecutionStrategy