activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r732259 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/broker/region/ activemq-core/src/main/java/org/apache/activemq/store/ activemq-core/src/main/java/org/apache/activemq/store/amq/ activemq-core/src/main/java/org/a...
Date Wed, 07 Jan 2009 08:03:41 GMT
Author: djencks
Date: Wed Jan  7 00:03:40 2009
New Revision: 732259

URL: http://svn.apache.org/viewvc?rev=732259&view=rev
Log:
AMQ-2053 introduce methods to remove (closed) message stores from possible caches in PersistenceAdapters

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/broker/region/DestinationFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactoryImpl.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.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/memory/MemoryPersistenceAdapter.java
    activemq/trunk/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAPersistenceAdapter.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=732259&r1=732258&r2=732259&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  7 00:03:40 2009
@@ -203,7 +203,7 @@
      * 
      * @return a set of matching destination objects.
      */
-    public Set getDestinations(ActiveMQDestination destination) {
+    public Set<Destination> getDestinations(ActiveMQDestination destination) {
         synchronized (destinationsMutex) {
             return destinationMap.get(destination);
         }
@@ -474,5 +474,6 @@
     protected void dispose(ConnectionContext context,Destination dest) throws Exception {
         dest.dispose(context);
         dest.stop();
+        destinationFactory.removeDestination(dest);
     }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactory.java
Wed Jan  7 00:03:40 2009
@@ -37,6 +37,8 @@
      */
     public abstract Destination createDestination(ConnectionContext context, ActiveMQDestination
destination, DestinationStatistics destinationStatistics) throws Exception;
 
+    public abstract void removeDestination(Destination dest);
+
     /**
      * Returns a set of all the {@link org.apache.activemq.command.ActiveMQDestination}
      * objects that the persistence store is aware exist.

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactoryImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactoryImpl.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactoryImpl.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationFactoryImpl.java
Wed Jan  7 00:03:40 2009
@@ -100,6 +100,18 @@
         }
     }
 
+    public void removeDestination(Destination dest) {
+        ActiveMQDestination destination = dest.getActiveMQDestination();
+        if (!destination.isTemporary()) {
+            if (destination.isQueue()) {
+                persistenceAdapter.removeQueueMessageStore((ActiveMQQueue) destination);
+            }
+            else if (!AdvisorySupport.isAdvisoryTopic(destination)) {
+                persistenceAdapter.removeTopicMessageStore((ActiveMQTopic) destination);
+            }
+        }
+    }
+
     protected void configureQueue(Queue queue, ActiveMQDestination destination) {
         if (broker == null) {
             throw new IllegalStateException("broker property is not set");

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
Wed Jan  7 00:03:40 2009
@@ -850,9 +850,9 @@
     
     /**
      * Move a message
-     * @param context
-     * @param r
-     * @param dest
+     * @param context connection context
+     * @param m message
+     * @param dest ActiveMQDestination
      * @throws Exception
      */
     public boolean moveMessageTo(ConnectionContext context,Message m,ActiveMQDestination
dest) throws Exception {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/PersistenceAdapter.java
Wed Jan  7 00:03:40 2009
@@ -22,6 +22,7 @@
 
 import org.apache.activemq.Service;
 import org.apache.activemq.broker.ConnectionContext;
+import org.apache.activemq.broker.region.Destination;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
@@ -59,6 +60,20 @@
     TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException;
 
     /**
+     * Cleanup method to remove any state associated with the given destination.
+     * This method does not stop the message store (it might not be cached).
+     * @param destination Destination to forget
+     */
+    void removeQueueMessageStore(ActiveMQQueue destination);
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     * This method does not stop the message store (it might not be cached).
+     * @param destination Destination to forget
+     */
+    void removeTopicMessageStore(ActiveMQTopic destination);
+
+    /**
      * Factory method to create a new persistent prepared transaction store for XA recovery
      * @return transaction store
      * @throws IOException 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
Wed Jan  7 00:03:40 2009
@@ -493,6 +493,24 @@
         return store;
     }
 
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination
+     */
+    public void removeQueueMessageStore(ActiveMQQueue destination) {
+        queues.remove(destination);
+    }
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination
+     */
+    public void removeTopicMessageStore(ActiveMQTopic destination) {
+        topics.remove(destination);
+    }
+
     public TransactionStore createTransactionStore() throws IOException {
         return transactionStore;
     }

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=732259&r1=732258&r2=732259&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
Wed Jan  7 00:03:40 2009
@@ -133,6 +133,24 @@
         return rc;
     }
 
+    /**
+     * 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) {
+    }
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     * No state retained.... nothing to do
+     *
+     * @param destination Destination to forget
+     */
+    public void removeTopicMessageStore(ActiveMQTopic destination) {
+    }
+
     public TransactionStore createTransactionStore() throws IOException {
         if (transactionStore == null) {
             transactionStore = new MemoryTransactionStore(this);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java
Wed Jan  7 00:03:40 2009
@@ -186,6 +186,24 @@
         return store;
     }
 
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeQueueMessageStore(ActiveMQQueue destination) {
+        queues.remove(destination);
+    }
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeTopicMessageStore(ActiveMQTopic destination) {
+        topics.remove(destination);
+    }
+
     public TransactionStore createTransactionStore() throws IOException {
         return transactionStore;
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java
Wed Jan  7 00:03:40 2009
@@ -134,6 +134,24 @@
         return rc;
     }
 
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeQueueMessageStore(ActiveMQQueue destination) {
+        queues.remove(destination);
+    }
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeTopicMessageStore(ActiveMQTopic destination) {
+        topics.remove(destination);
+    }
+
     protected MessageStore retrieveMessageStore(Object id) {
         MessageStore result = messageStores.get(id);
         return result;

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=732259&r1=732258&r2=732259&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  7 00:03:40 2009
@@ -425,7 +425,25 @@
     public TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException
{
         return new KahaDBTopicMessageStore(destination);
     }
-    
+
+    /**
+     * Cleanup method to remove any state associated with the given destination.
+     * This method does not stop the message store (it might not be cached).
+     *
+     * @param destination Destination to forget
+     */
+    public void removeQueueMessageStore(ActiveMQQueue destination) {
+    }
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     * This method does not stop the message store (it might not be cached).
+     *
+     * @param destination Destination to forget
+     */
+    public void removeTopicMessageStore(ActiveMQTopic destination) {
+    }
+
     public void deleteAllMessages() throws IOException {
         deleteAllMessages=true;
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/memory/MemoryPersistenceAdapter.java
Wed Jan  7 00:03:40 2009
@@ -87,6 +87,24 @@
         return rc;
     }
 
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeQueueMessageStore(ActiveMQQueue destination) {
+        queues.remove(destination);
+    }
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeTopicMessageStore(ActiveMQTopic destination) {
+        topics.remove(destination);
+    }
+
     public TransactionStore createTransactionStore() throws IOException {
         if (transactionStore == null) {
             transactionStore = new MemoryTransactionStore(this);

Modified: activemq/trunk/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAPersistenceAdapter.java?rev=732259&r1=732258&r2=732259&view=diff
==============================================================================
--- activemq/trunk/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-jpa-store/src/main/java/org/apache/activemq/store/jpa/JPAPersistenceAdapter.java
Wed Jan  7 00:03:40 2009
@@ -128,6 +128,22 @@
         return rc;
     }
 
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeQueueMessageStore(ActiveMQQueue destination) {
+    }
+
+    /**
+     * Cleanup method to remove any state associated with the given destination
+     *
+     * @param destination Destination to forget
+     */
+    public void removeTopicMessageStore(ActiveMQTopic destination) {
+    }
+
     public TransactionStore createTransactionStore() throws IOException {
         if (transactionStore == null) {
             transactionStore = new MemoryTransactionStore(this);



Mime
View raw message