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

davsclaus 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 df917f34b6c CAMEL-20158: wait till tasks finish before shutting down 
executors (#12273)
df917f34b6c is described below

commit df917f34b6cfb3099cfa2e8b4a78b12d0652bf9c
Author: Jono Morris <j...@apache.org>
AuthorDate: Fri Dec 1 00:46:38 2023 +1300

    CAMEL-20158: wait till tasks finish before shutting down executors (#12273)
---
 .../src/test/java/org/apache/camel/processor/ThrottlerTest.java      | 5 +++++
 .../test/java/org/apache/camel/processor/ThrottlingGroupingTest.java | 3 +++
 2 files changed, 8 insertions(+)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java 
b/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java
index 65a37a84fda..7072bb1d110 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java
@@ -20,6 +20,7 @@ import java.util.Arrays;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -55,6 +56,7 @@ public class ThrottlerTest extends ContextTestSupport {
             }
             assertMockEndpointsSatisfied();
         } finally {
+            executor.awaitTermination(1000, TimeUnit.MILLISECONDS);
             executor.shutdownNow();
         }
     }
@@ -82,6 +84,7 @@ public class ThrottlerTest extends ContextTestSupport {
         try {
             sendMessagesWithHeaderExpression(executor, resultEndpoint, 
CONCURRENT_REQUESTS, MESSAGE_COUNT);
         } finally {
+            executor.awaitTermination(1000, TimeUnit.MILLISECONDS);
             executor.shutdownNow();
         }
     }
@@ -111,6 +114,7 @@ public class ThrottlerTest extends ContextTestSupport {
             resultEndpoint.reset();
             sendMessagesWithHeaderExpression(executor, resultEndpoint, 4, 
MESSAGE_COUNT);
         } finally {
+            executor.awaitTermination(1000, TimeUnit.MILLISECONDS);
             executor.shutdownNow();
         }
     }
@@ -152,6 +156,7 @@ public class ThrottlerTest extends ContextTestSupport {
                 receivingEndpoint.assertIsSatisfied();
             }
         } finally {
+            executor.awaitTermination(1000, TimeUnit.MILLISECONDS);
             executor.shutdownNow();
         }
     }
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlingGroupingTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlingGroupingTest.java
index 4c38353490d..2c11829333c 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlingGroupingTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/ThrottlingGroupingTest.java
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -108,6 +109,7 @@ public class ThrottlingGroupingTest extends 
ContextTestSupport {
                 receivingEndpoint.assertIsSatisfied();
             }
         } finally {
+            executor.awaitTermination(1000, TimeUnit.MILLISECONDS);
             executor.shutdownNow();
         }
     }
@@ -121,6 +123,7 @@ public class ThrottlingGroupingTest extends 
ContextTestSupport {
         try {
             sendMessagesWithHeaderExpression(executor, resultEndpoint, 
CONCURRENT_REQUESTS, MESSAGE_COUNT);
         } finally {
+            executor.awaitTermination(1000, TimeUnit.MILLISECONDS);
             executor.shutdownNow();
         }
     }

Reply via email to