activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: fix intermittent ci failure w.r.t timing of initial delivery
Date Wed, 27 Jul 2016 11:07:32 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 6b8e743b0 -> 51b413309


fix intermittent ci failure w.r.t timing of initial delivery


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/51b41330
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/51b41330
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/51b41330

Branch: refs/heads/master
Commit: 51b413309caffb776a67158432e85b3ace41f013
Parents: 6b8e743
Author: gtully <gary.tully@gmail.com>
Authored: Wed Jul 27 12:07:18 2016 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Wed Jul 27 12:07:18 2016 +0100

----------------------------------------------------------------------
 .../src/test/java/org/apache/activemq/ra/MDBTest.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/51b41330/activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java b/activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java
index 43785f1..a078a91 100644
--- a/activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java
+++ b/activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java
@@ -631,12 +631,15 @@ public class MDBTest {
                 super.onMessage(message);
                 try {
                     long now = System.currentTimeMillis();
-                    if ((now - timeReceived.getAndSet(now)) > 1000) {
+                    if (timeReceived.get() == 0) {
+                        timeReceived.set(now);
+                    }
+                    if ((now - timeReceived.getAndSet(now)) >= 1000) {
                         failed.set(true);
                     }
                     messageDelivered.countDown();
                     if (!messageDelivered.await(1, TimeUnit.MILLISECONDS)) {
-                        throw new RuntimeException("ex on first delivery");
+                        throw new RuntimeException("ex on delivery: " + messageDelivered.getCount());
                     } else {
                         try {
                             assertTrue(message.getJMSRedelivered());
@@ -694,13 +697,13 @@ public class MDBTest {
         } catch (Exception e) {
 
         }
-        timeReceived.set(System.currentTimeMillis());
+        timeReceived.set(0);
         // Send the broker a message to that endpoint
         MessageProducer producer = session.createProducer(new ActiveMQQueue("TEST"));
         producer.send(session.createTextMessage("Hello!"));
         connection.close();
 
-        // Wait for the message to be delivered twice.
+        // Wait for the message to be delivered.
         assertTrue(messageDelivered.await(10000, TimeUnit.MILLISECONDS));
         assertFalse("Delivery policy delay not working", failed.get());
 


Mime
View raw message