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 2009/10/23 12:22:46 UTC

svn commit: r828989 - in /activemq/branches/activemq-5.3/activemq-core/src: main/java/org/apache/activemq/broker/region/ main/java/org/apache/activemq/broker/region/cursors/ test/java/org/apache/activemq/bugs/ test/resources/

Author: gtully
Date: Fri Oct 23 10:22:46 2009
New Revision: 828989

URL: http://svn.apache.org/viewvc?rev=828989&view=rev
Log:
merge 828975 - fix for resolve https://issues.apache.org/activemq/browse/AMQ-2314 - spooled non persistent messages for a topic sub remain after disconnect, pendin messages are now removed so that the temp store can be reclaimed

Added:
    activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2314Test.java
      - copied unchanged from r828975, activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2314Test.java
Modified:
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
    activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
    activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java
    activemq/branches/activemq-5.3/activemq-core/src/test/resources/log4j.properties

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java?rev=828989&r1=828988&r2=828989&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java (original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java Fri Oct 23 10:22:46 2009
@@ -82,12 +82,9 @@
 
     public void add(MessageReference node) throws Exception {
         enqueueCounter.incrementAndGet();
-        node.incrementReferenceCount();
         if (!isFull() && matched.isEmpty()  && !isSlave()) {
-            // if maximumPendingMessages is set we will only discard messages
-            // which
-            // have not been dispatched (i.e. we allow the prefetch buffer to be
-            // filled)
+            // if maximumPendingMessages is set we will only discard messages which
+            // have not been dispatched (i.e. we allow the prefetch buffer to be filled)
             dispatch(node);
             slowConsumer=false;
         } else {
@@ -402,6 +399,7 @@
 
     private void dispatch(final MessageReference node) throws IOException {
         Message message = (Message)node;
+        node.incrementReferenceCount();
         // Make sure we can dispatch a message.
         MessageDispatch md = new MessageDispatch();
         md.setMessage(message);

Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java?rev=828989&r1=828988&r2=828989&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java (original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java Fri Oct 23 10:22:46 2009
@@ -138,8 +138,17 @@
             node.decrementReferenceCount();
         }
         memoryList.clear();
+        destroyDiskList();
+    }
+
+    private void destroyDiskList() {
         if (!isDiskListEmpty()) {
-            getDiskList().clear();
+            Iterator<MessageReference> iterator = diskList.iterator();
+            while (iterator.hasNext()) {
+                iterator.next();
+                iterator.remove();
+            }
+            diskList.clear();
         }
     }
 
@@ -384,7 +393,7 @@
                 diskList = store.getListContainer(name, "TopicSubscription", true);
                 diskList.setMarshaller(new CommandMarshaller(new OpenWireFormat()));
             } catch (IOException e) {
-                LOG.error("Caught an IO Exception getting the DiskList ",e);
+                LOG.error("Caught an IO Exception getting the DiskList " + name, e);
                 throw new RuntimeException(e);
             }
         }

Modified: activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java?rev=828989&r1=828988&r2=828989&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java (original)
+++ activemq/branches/activemq-5.3/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java Fri Oct 23 10:22:46 2009
@@ -499,6 +499,9 @@
             }
         }
         assertTrue("No timeout waiting for senders/receivers to complete", System.currentTimeMillis() < expiry);
+        if (!exceptions.isEmpty()) {
+            exceptions.get(0).printStackTrace();
+        }
         assertTrue("No exceptions", exceptions.isEmpty());
     }
 

Modified: activemq/branches/activemq-5.3/activemq-core/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/test/resources/log4j.properties?rev=828989&r1=828988&r2=828989&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/test/resources/log4j.properties (original)
+++ activemq/branches/activemq-5.3/activemq-core/src/test/resources/log4j.properties Fri Oct 23 10:22:46 2009
@@ -20,7 +20,7 @@
 #
 log4j.rootLogger=INFO, out, stdout
 
-log4j.logger.org.apache.activemq.spring=WARN
+#log4j.logger.org.apache.activemq=DEBUG
 
 # CONSOLE appender not used by default
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender