You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2010/01/28 16:45:55 UTC

svn commit: r904139 - in /activemq/branches/activemq-5.3/activemq-core/src: main/java/org/apache/activemq/store/kahadb/ test/java/org/apache/activemq/bugs/

Author: dejanb
Date: Thu Jan 28 15:45:55 2010
New Revision: 904139

URL: http://svn.apache.org/viewvc?rev=904139&view=rev
Log:
merging 903741 - intermittent failures of DurableConsumerTest

Modified:
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java
    activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java?rev=904139&r1=904138&r2=904139&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java (original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java Thu Jan 28 15:45:55 2010
@@ -429,7 +429,7 @@
                             }
                         }
                         if( entry!=null ) {
-                            sd.subscriptionCursors.put(subscriptionKey, cursorPos+1);
+                            sd.subscriptionCursors.put(subscriptionKey, entry.getKey() + 1);
                         }
                     }
                 });

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java?rev=904139&r1=904138&r2=904139&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java (original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java Thu Jan 28 15:45:55 2010
@@ -400,7 +400,7 @@
                             }
                         }
                         if( entry!=null ) {
-                            sd.subscriptionCursors.put(subscriptionKey, cursorPos+1);
+                            sd.subscriptionCursors.put(subscriptionKey, entry.getKey() + 1);
                         }
                     }
                 });

Modified: activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java?rev=904139&r1=904138&r2=904139&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java (original)
+++ activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java Thu Jan 28 15:45:55 2010
@@ -212,7 +212,7 @@
         final String topicName = getName();
         final int numMessages = 500;
         int numConsumers = 20;
-        final CountDownLatch counsumerStarted = new CountDownLatch(0);
+        final CountDownLatch counsumerStarted = new CountDownLatch(numConsumers);
         final AtomicInteger receivedCount = new AtomicInteger();
         Runnable consumer = new Runnable() {
             public void run() {
@@ -241,7 +241,10 @@
                             msg = consumer.receive(5000);
                             if (msg != null) {
                                 receivedCount.incrementAndGet();
-                                if (received++ % 2 == 0) {
+                                if (received != 0 && received % 100 == 0) {
+                                    LOG.info("Received msg: " + msg.getJMSMessageID());
+                                }
+                                if (++received % 2 == 0) {
                                     msg.acknowledge();
                                     acked++;
                                 }
@@ -286,10 +289,11 @@
         
         Wait.waitFor(new Wait.Condition() {
             public boolean isSatisified() throws Exception {
-                return receivedCount.get() > numMessages;
+                LOG.info("receivedCount: " + receivedCount.get());
+                return receivedCount.get() == numMessages;
             } 
         });
-        assertTrue("got some messages: " + receivedCount.get(), receivedCount.get() > numMessages);
+        assertEquals("got required some messages", numMessages, receivedCount.get());
         assertTrue("no exceptions, but: " + exceptions, exceptions.isEmpty());
     }