activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: Auto-delete JMS, not just core
Date Thu, 05 May 2016 21:11:03 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 02ca942d3 -> 41d81d68c


Auto-delete JMS, not just core


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5c7aaa76
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5c7aaa76
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5c7aaa76

Branch: refs/heads/master
Commit: 5c7aaa760a9c959ad8d512509d7d63455e7efe56
Parents: 02ca942
Author: jbertram <jbertram@apache.org>
Authored: Thu May 5 10:37:28 2016 -0500
Committer: jbertram <jbertram@apache.org>
Committed: Thu May 5 11:43:39 2016 -0500

----------------------------------------------------------------------
 .../jms/server/impl/JMSServerManagerImpl.java   | 17 +++++++-----
 .../artemis/core/server/ActiveMQServer.java     | 14 +++++++++-
 .../artemis/core/server/QueueDeleter.java       | 28 ++++++++++++++++++++
 .../core/server/impl/ActiveMQServerImpl.java    | 16 +++++++++++
 .../impl/AutoCreatedQueueManagerImpl.java       |  2 +-
 5 files changed, 69 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5c7aaa76/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
index c9a1617..5181731 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
@@ -50,6 +50,7 @@ import org.apache.activemq.artemis.core.server.ActivateCallback;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.QueueCreator;
+import org.apache.activemq.artemis.core.server.QueueDeleter;
 import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
@@ -372,6 +373,8 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
 
       server.setJMSQueueCreator(new JMSQueueCreator());
 
+      server.setJMSQueueDeleter(new JMSQueueDeleter());
+
       server.registerActivateCallback(this);
       /**
        * See this method's javadoc.
@@ -1617,15 +1620,11 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
    }
 
    class JMSQueueCreator implements QueueCreator {
-
-      private final SimpleString PREFIX = SimpleString.toSimpleString("jms.queue");
-
       @Override
       public boolean create(SimpleString address) throws Exception {
          AddressSettings settings = server.getAddressSettingsRepository().getMatch(address.toString());
-         if (address.startsWith(PREFIX) && settings.isAutoCreateJmsQueues()) {
-            // stopped here... finish here
-            JMSServerManagerImpl.this.internalCreateJMSQueue(false, address.toString().substring(PREFIX.toString().length()
+ 1), null, true, true);
+         if (address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX)
&& settings.isAutoCreateJmsQueues()) {
+            JMSServerManagerImpl.this.internalCreateJMSQueue(false, address.toString().substring(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX.length()),
null, true, true);
             return true;
          }
          else {
@@ -1634,4 +1633,10 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
       }
    }
 
+   class JMSQueueDeleter implements QueueDeleter {
+      @Override
+      public boolean delete(SimpleString address) throws Exception {
+         return JMSServerManagerImpl.this.destroyQueue(address.toString().substring(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX.length()),
false);
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5c7aaa76/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
index 3719453..0c6fe11 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
@@ -187,7 +187,7 @@ public interface ActiveMQServer extends ActiveMQComponent {
    long getUptimeMillis();
 
    /**
-    * This is the queue creator responsible for JMS Queue creations*
+    * This is the queue creator responsible for automatic JMS Queue creations.
     *
     * @param queueCreator
     */
@@ -199,6 +199,18 @@ public interface ActiveMQServer extends ActiveMQComponent {
    QueueCreator getJMSQueueCreator();
 
    /**
+    * This is the queue deleter responsible for automatic JMS Queue deletions.
+    *
+    * @param queueDeleter
+    */
+   void setJMSQueueDeleter(QueueDeleter queueDeleter);
+
+   /**
+    * @see org.apache.activemq.artemis.core.server.ActiveMQServer#setJMSQueueDeleter(QueueDeleter)
+    */
+   QueueDeleter getJMSQueueDeleter();
+
+   /**
     * Wait for server initialization.
     *
     * @param timeout

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5c7aaa76/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueDeleter.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueDeleter.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueDeleter.java
new file mode 100644
index 0000000..4bdb8a4
--- /dev/null
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueDeleter.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.core.server;
+
+import org.apache.activemq.artemis.api.core.SimpleString;
+
+public interface QueueDeleter {
+
+   /**
+    * @return True if a queue was deleted.
+    */
+   boolean delete(SimpleString address) throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5c7aaa76/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 40a7b6c..641cedd 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -108,6 +108,7 @@ import org.apache.activemq.artemis.core.server.MemoryManager;
 import org.apache.activemq.artemis.core.server.NodeManager;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.QueueCreator;
+import org.apache.activemq.artemis.core.server.QueueDeleter;
 import org.apache.activemq.artemis.core.server.QueueFactory;
 import org.apache.activemq.artemis.core.server.QueueQueryResult;
 import org.apache.activemq.artemis.core.server.SecuritySettingPlugin;
@@ -243,6 +244,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
     */
    private QueueCreator jmsQueueCreator;
 
+   /**
+    * This will be set by the JMS Queue Manager.
+    */
+   private QueueDeleter jmsQueueDeleter;
+
    private final Map<String, ServerSession> sessions = new ConcurrentHashMap<>();
 
    /**
@@ -658,6 +664,16 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       this.jmsQueueCreator = jmsQueueCreator;
    }
 
+   @Override
+   public QueueDeleter getJMSQueueDeleter() {
+      return jmsQueueDeleter;
+   }
+
+   @Override
+   public void setJMSQueueDeleter(QueueDeleter jmsQueueDeleter) {
+      this.jmsQueueDeleter = jmsQueueDeleter;
+   }
+
    /**
     * Stops the server
     *

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5c7aaa76/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java
index 9895a30..25fc60a 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java
@@ -46,7 +46,7 @@ public class AutoCreatedQueueManagerImpl implements AutoCreatedQueueManager
{
                   logger.debug("deleting auto-created queue \"" + queueName + ".\" consumerCount
= " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " +
isAutoDeleteJmsQueues);
                }
 
-               server.destroyQueue(queueName, null, false);
+               server.getJMSQueueDeleter().delete(queueName);
             }
             else if (logger.isDebugEnabled()) {
                logger.debug("NOT deleting auto-created queue \"" + queueName + ".\" consumerCount
= " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " +
isAutoDeleteJmsQueues);


Mime
View raw message