orpiske commented on code in PR #11945:
URL: https://github.com/apache/camel/pull/11945#discussion_r1387718714


##########
components/camel-jms/src/test/java/org/apache/camel/component/jms/AggregatedJmsRouteTest.java:
##########
@@ -92,12 +93,8 @@ public void configure() {
                 
from(timeOutEndpointUri).to("jms:queue:AggregatedJmsRouteTestQueueB");
 
                 
from("jms:queue:AggregatedJmsRouteTestQueueB").aggregate(header("cheese"), 
(oldExchange, newExchange) -> {
-                    try {
-                        Thread.sleep(2000);
-                    } catch (InterruptedException e) {
-                        LOG.error("aggregation delay sleep interrupted", e);
-                        fail("aggregation delay sleep interrupted");
-                    }
+                    Awaitility.await().atMost(2, TimeUnit.SECONDS)
+                            .until(() -> true);

Review Comment:
   I think Thread.sleep is fine here. 



##########
components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/TempReplyToIssueTest.java:
##########
@@ -75,7 +78,9 @@ public String handleMessage(
         producer.stop();
 
         // sleep a bit so Camel will send the reply a bit later
-        Thread.sleep(1000);
+        Awaitility.await()
+                .pollDelay(Duration.ofMillis(1000))
+                .until(() -> true);

Review Comment:
   I think `Thread.sleep` is fine here.



##########
components/camel-jms/src/test/java/org/apache/camel/component/jms/async/MyAsyncProducer.java:
##########
@@ -51,7 +53,10 @@ public boolean process(final Exchange exchange, final 
AsyncCallback callback) {
         executor.submit(() -> {
 
             LOG.info("Simulating a task which takes {} millis to reply", 
getEndpoint().getDelay());
-            Thread.sleep(getEndpoint().getDelay());
+
+            Awaitility.await()
+                    .pollDelay(Duration.ofMillis(getEndpoint().getDelay()))
+                    .until(() -> true);

Review Comment:
   I think Thread.sleep is fine here.



##########
components/camel-jms/src/test/java/org/apache/camel/component/jms/temp/JmsReconnectManualTest.java:
##########
@@ -102,7 +105,9 @@ public void configure() {
          * Wait long enough for the jms client to do a full reconnect. In the 
Tibco EMS case this means that a Temporary
          * Destination created before is invalid now
          */
-        Thread.sleep(5000);
+        Awaitility.await()
+                .pollDelay(Duration.ofMillis(5000))
+                .until(() -> true);

Review Comment:
   I think `Thread.sleep` is fine here.



-- 
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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to