You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2010/01/27 18:15:11 UTC

svn commit: r903741 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/region/ main/java/org/apache/activemq/store/kahadb/ test/java/org/apache/activemq/bugs/

Author: gtully
Date: Wed Jan 27 17:15:09 2010
New Revision: 903741

URL: http://svn.apache.org/viewvc?rev=903741&view=rev
Log:
resolve hudson failure with DurableConsumerTest related to kahaDB under the FilePendingMessageCursor - fixes the cursor got duplicates error and improves the test now that there are no more duplicates. relates to https://issues.apache.org/activemq/browse/AMQ-2575

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java?rev=903741&r1=903740&r2=903741&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java Wed Jan 27 17:15:09 2010
@@ -507,7 +507,9 @@
         Subscription sub = subscriptions.get(control.getConsumerId());
         if (sub != null && sub instanceof AbstractSubscription) {
             ((AbstractSubscription)sub).setPrefetchSize(control.getPrefetch());
-            LOG.info("setting prefetch: " + control.getPrefetch() + ", on subscription: " + control.getConsumerId());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("setting prefetch: " + control.getPrefetch() + ", on subscription: " + control.getConsumerId());
+            }
             try {
                 lookup(consumerExchange.getConnectionContext(), control.getDestination()).wakeup();
             } catch (Exception e) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java?rev=903741&r1=903740&r2=903741&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java Wed Jan 27 17:15:09 2010
@@ -429,7 +429,7 @@
                             }
                         }
                         if( entry!=null ) {
-                            sd.subscriptionCursors.put(subscriptionKey, cursorPos+1);
+                            sd.subscriptionCursors.put(subscriptionKey, entry.getKey() + 1);
                         }
                     }
                 });

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java?rev=903741&r1=903740&r2=903741&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/TempKahaDBStore.java Wed Jan 27 17:15:09 2010
@@ -400,7 +400,7 @@
                             }
                         }
                         if( entry!=null ) {
-                            sd.subscriptionCursors.put(subscriptionKey, cursorPos+1);
+                            sd.subscriptionCursors.put(subscriptionKey, entry.getKey() + 1);
                         }
                     }
                 });

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java?rev=903741&r1=903740&r2=903741&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java Wed Jan 27 17:15:09 2010
@@ -206,7 +206,7 @@
         final String topicName = getName();
         final int numMessages = 500;
         int numConsumers = 1;
-        final CountDownLatch counsumerStarted = new CountDownLatch(0);
+        final CountDownLatch counsumerStarted = new CountDownLatch(numConsumers);
         final AtomicInteger receivedCount = new AtomicInteger();
         Runnable consumer = new Runnable(){
             public void run(){
@@ -232,7 +232,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++;
                                 }
@@ -277,10 +280,11 @@
         
         Wait.waitFor(new Wait.Condition(){
             public boolean isSatisified() throws Exception{
-                return receivedCount.get() > numMessages;
+                LOG.info("receivedCount: " + receivedCount.get());
+                return receivedCount.get() == numMessages;
             }
         }, 60 * 1000);
-        assertTrue("got some messages: " + receivedCount.get(), receivedCount.get() > numMessages);
+        assertEquals("got required some messages", numMessages, receivedCount.get());
         assertTrue("no exceptions, but: " + exceptions, exceptions.isEmpty());
     }