activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1240994 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java test/java/org/apache/activemq/store/PersistenceAdapterTestSupport.java
Date Mon, 06 Feb 2012 12:05:18 GMT
Author: gtully
Date: Mon Feb  6 12:05:17 2012
New Revision: 1240994

URL: http://svn.apache.org/viewvc?rev=1240994&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3695 - ensure destination deletion removes entry
in the acks table

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/PersistenceAdapterTestSupport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java?rev=1240994&r1=1240993&r2=1240994&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
Mon Feb  6 12:05:17 2012
@@ -201,11 +201,29 @@ public class JDBCPersistenceAdapter exte
 
     /**
      * Cleanup method to remove any state associated with the given destination
-     * No state retained.... nothing to do
-     *
      * @param destination Destination to forget
      */
     public void removeQueueMessageStore(ActiveMQQueue destination) {
+        if (destination.isQueue() && getBrokerService().shouldRecordVirtualDestination(destination))
{
+            try {
+                removeConsumerDestination(destination);
+            } catch (IOException ioe) {
+                LOG.error("Failed to remove consumer destination: " + destination, ioe);
+            }
+        }
+    }
+
+    private void removeConsumerDestination(ActiveMQQueue destination) throws IOException
{
+        TransactionContext c = getTransactionContext();
+        try {
+            String id = destination.getQualifiedName();
+            getAdapter().doDeleteSubscription(c, destination, id, id);
+        } catch (SQLException e) {
+            JDBCPersistenceAdapter.log("JDBC Failure: ", e);
+            throw IOExceptionSupport.create("Failed to remove consumer destination: " + destination,
e);
+        } finally {
+            c.close();
+        }
     }
 
     /**

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/PersistenceAdapterTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/PersistenceAdapterTestSupport.java?rev=1240994&r1=1240993&r2=1240994&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/PersistenceAdapterTestSupport.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/PersistenceAdapterTestSupport.java
Mon Feb  6 12:05:17 2012
@@ -97,4 +97,11 @@ abstract public class PersistenceAdapter
 
     }
 
+    public void testAddRemoveConsumerDest() throws Exception {
+        ActiveMQQueue consumerQ = new ActiveMQQueue("Consumer.A.VirtualTopicTest");
+        MessageStore ms = pa.createQueueMessageStore(consumerQ);
+        pa.removeQueueMessageStore(consumerQ);
+        assertFalse(pa.getDestinations().contains(consumerQ));
+    }
+
 }



Mime
View raw message