You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/08/10 14:39:05 UTC

[camel] 01/02: CAMEL-19684: A little potential fix but lets enable it for CI to keep an eye again

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

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

commit 670f685f16e831349ad68eb310f0dd16ed21fec5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 10 16:31:45 2023 +0200

    CAMEL-19684: A little potential fix but lets enable it for CI to keep an eye again
---
 .../camel/management/ManagedPooledExchangeTest.java      | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/core/camel-management/src/test/java/org/apache/camel/management/ManagedPooledExchangeTest.java b/core/camel-management/src/test/java/org/apache/camel/management/ManagedPooledExchangeTest.java
index 89453a793b8..c9044595bc1 100644
--- a/core/camel-management/src/test/java/org/apache/camel/management/ManagedPooledExchangeTest.java
+++ b/core/camel-management/src/test/java/org/apache/camel/management/ManagedPooledExchangeTest.java
@@ -30,7 +30,6 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.engine.PooledExchangeFactory;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
 import org.junit.jupiter.api.condition.DisabledOnOs;
 import org.junit.jupiter.api.condition.OS;
 
@@ -39,7 +38,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertSame;
 
 @DisabledOnOs(OS.AIX)
-@DisabledIfSystemProperty(named = "ci.env.name", matches = "github.com", disabledReason = "Flaky on Github CI")
 public class ManagedPooledExchangeTest extends ManagementTestSupport {
 
     private final AtomicInteger counter = new AtomicInteger();
@@ -116,12 +114,14 @@ public class ManagedPooledExchangeTest extends ManagementTestSupport {
                             @Override
                             public void process(Exchange exchange) throws Exception {
                                 // should be same exchange instance as its pooled
-                                Exchange old = ref.get();
-                                if (old == null) {
-                                    ref.set(exchange);
-                                    exchange.getMessage().setHeader("first", true);
-                                } else {
-                                    assertSame(old, exchange);
+                                synchronized (this) {
+                                    Exchange old = ref.get();
+                                    if (old == null) {
+                                        ref.set(exchange);
+                                        exchange.getMessage().setHeader("first", true);
+                                    } else {
+                                        assertSame(old, exchange);
+                                    }
                                 }
                             }
                         })