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 70e0589a1b04 CAMEL-20997: core - bound the start-gate waits in three 
concurrency tests (#31069)
70e0589a1b04 is described below

commit 70e0589a1b04e7c0bfe0e8c121b48450db348866
Author: dhairya05 <[email protected]>
AuthorDate: Mon Nov 30 14:02:13 2026 +0530

    CAMEL-20997: core - bound the start-gate waits in three concurrency tests 
(#31069)
    
    Three concurrency tests park a worker on an unbounded wait, which 
CAMEL-20997
    calls out by name (latch.await(), locks without a maximum await time):
    
    - ManagedPerformanceCounterTest#testConcurrentExchangesAreAllCounted
    - StatisticMinimumMaximumTest#testConcurrentUpdates
    - SimpleBackOffTimerTest#testCancelWhileCompletionCallbackWaitsForLock
    
    None of them hangs CI today: the two camel-management tests bound the main
    thread with future.get(30, SECONDS), and all three call shutdownNow() in a
    finally, which interrupts a parked worker. What the unbounded wait costs is
    the failure mode -- a gate that never opens surfaces 30 seconds later as a
    TimeoutException from future.get, pointing at the wrong thing.
    
    The camel-management tests now assert on a bounded wait, which reaches the
    test thread through the existing future.get as an ExecutionException.
    SimpleBackOffTimerTest throws instead: its wait runs inside a BackOffTimer
    task callback, where an AssertionError would be routed into the task's
    completion handler and change what the test exercises.
    
    10 seconds is generous for a gate that opens on the next statement, and
    matches the 10-30 second guidance in CLAUDE.md for loaded CI machines.
    
    Test-only; no assertion or timing expectation changes.
    
    Co-Authored-By: Claude <[email protected]>
---
 .../apache/camel/management/mbean/ManagedPerformanceCounterTest.java  | 2 +-
 .../apache/camel/management/mbean/StatisticMinimumMaximumTest.java    | 2 +-
 .../java/org/apache/camel/util/backoff/SimpleBackOffTimerTest.java    | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-management/src/test/java/org/apache/camel/management/mbean/ManagedPerformanceCounterTest.java
 
b/core/camel-management/src/test/java/org/apache/camel/management/mbean/ManagedPerformanceCounterTest.java
index cb56c36ef800..57c4935e66a3 100644
--- 
a/core/camel-management/src/test/java/org/apache/camel/management/mbean/ManagedPerformanceCounterTest.java
+++ 
b/core/camel-management/src/test/java/org/apache/camel/management/mbean/ManagedPerformanceCounterTest.java
@@ -198,7 +198,7 @@ public class ManagedPerformanceCounterTest {
             for (int t = 0; t < THREADS; t++) {
                 final long time = t + 1L;
                 futures.add(executor.submit(() -> {
-                    start.await();
+                    assertTrue(start.await(10, TimeUnit.SECONDS), "the start 
gate was never opened");
                     Exchange exchange = new DefaultExchange(context);
                     for (int i = 0; i < UPDATES; i++) {
                         counter.processExchange(exchange, "processor");
diff --git 
a/core/camel-management/src/test/java/org/apache/camel/management/mbean/StatisticMinimumMaximumTest.java
 
b/core/camel-management/src/test/java/org/apache/camel/management/mbean/StatisticMinimumMaximumTest.java
index f9994aeecc4a..fb34b299a15b 100644
--- 
a/core/camel-management/src/test/java/org/apache/camel/management/mbean/StatisticMinimumMaximumTest.java
+++ 
b/core/camel-management/src/test/java/org/apache/camel/management/mbean/StatisticMinimumMaximumTest.java
@@ -72,7 +72,7 @@ public class StatisticMinimumMaximumTest {
             for (int t = 0; t < THREADS; t++) {
                 final int thread = t;
                 futures.add(executor.submit(() -> {
-                    start.await();
+                    assertTrue(start.await(10, TimeUnit.SECONDS), "the start 
gate was never opened");
                     for (int i = 0; i < UPDATES; i++) {
                         max.updateValue((long) i * THREADS + thread + 1);
                         min.updateValue((long) (UPDATES - i) * THREADS - 
thread);
diff --git 
a/core/camel-util/src/test/java/org/apache/camel/util/backoff/SimpleBackOffTimerTest.java
 
b/core/camel-util/src/test/java/org/apache/camel/util/backoff/SimpleBackOffTimerTest.java
index 28190a03dc70..f0604efced31 100644
--- 
a/core/camel-util/src/test/java/org/apache/camel/util/backoff/SimpleBackOffTimerTest.java
+++ 
b/core/camel-util/src/test/java/org/apache/camel/util/backoff/SimpleBackOffTimerTest.java
@@ -232,7 +232,9 @@ public class SimpleBackOffTimerTest {
                     backOff,
                     context -> {
                         timerThread.set(Thread.currentThread());
-                        ownerHoldsLock.await();
+                        if (!ownerHoldsLock.await(10, TimeUnit.SECONDS)) {
+                            throw new IllegalStateException("the owner never 
took the lock");
+                        }
                         // done, so the task completes
                         return false;
                     });

Reply via email to