activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [2/3] activemq git commit: AMQ-6411 - tidy up latch between runs. Have not seen repeat of npe yet
Date Thu, 01 Sep 2016 15:55:12 GMT
AMQ-6411 - tidy up latch between runs. Have not seen repeat of npe yet


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

Branch: refs/heads/master
Commit: a9c7f7122badd6bc46237cdeeaa64e892d9fa045
Parents: f8bc19b
Author: gtully <gary.tully@gmail.com>
Authored: Thu Sep 1 16:53:02 2016 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Thu Sep 1 16:53:02 2016 +0100

----------------------------------------------------------------------
 .../org/apache/activemq/bugs/AMQ4952Test.java   | 25 ++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/a9c7f712/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
index cc16b75..0b99555 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java
@@ -115,9 +115,9 @@ public class AMQ4952Test {
 
     protected ActiveMQQueue QUEUE_NAME = new ActiveMQQueue("duptest.store");
 
-    private final CountDownLatch stopConsumerBroker = new CountDownLatch(1);
-    private final CountDownLatch consumerBrokerRestarted = new CountDownLatch(1);
-    private final CountDownLatch consumerRestartedAndMessageForwarded = new CountDownLatch(1);
+    private CountDownLatch stopConsumerBroker;
+    private CountDownLatch consumerBrokerRestarted;
+    private CountDownLatch consumerRestartedAndMessageForwarded;
 
     private EmbeddedDataSource localDataSource;
 
@@ -134,6 +134,15 @@ public class AMQ4952Test {
         System.setProperty("derby.system.home", new File(IOHelper.getDefaultDataDirectory()).getCanonicalPath());
     }
 
+    public void repeat() throws Exception {
+        for (int i=0; i<10; i++) {
+            LOG.info("Iteration: " + i);
+            testConsumerBrokerRestart();
+            tearDown();
+            setUp();
+        }
+    }
+
     @Test
     public void testConsumerBrokerRestart() throws Exception {
 
@@ -155,7 +164,11 @@ public class AMQ4952Test {
                     MessageConsumer messageConsumer = consumerSession.createConsumer(QUEUE_NAME);
 
                     while (true) {
-                        TextMessage textMsg = (TextMessage) messageConsumer.receive(5000);
+                        TextMessage textMsg = (TextMessage) messageConsumer.receive(1000);
+
+                        if (textMsg == null) {
+                            textMsg = (TextMessage) messageConsumer.receive(4000);
+                        }
 
                         if (textMsg == null) {
                             return receivedMessageCount;
@@ -266,6 +279,10 @@ public class AMQ4952Test {
     @Before
     public void setUp() throws Exception {
         LOG.debug("Running with enableCursorAudit set to {}", this.enableCursorAudit);
+        stopConsumerBroker = new CountDownLatch(1);
+        consumerBrokerRestarted = new CountDownLatch(1);
+        consumerRestartedAndMessageForwarded = new CountDownLatch(1);
+
         doSetUp();
     }
 


Mime
View raw message