[jboss-cvs] JBoss Messaging SVN: r5055 - in trunk/src/main/org/jboss/messaging/jms/server: impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 1 04:27:34 EDT 2008


Author: jmesnil
Date: 2008-10-01 04:27:34 -0400 (Wed, 01 Oct 2008)
New Revision: 5055

Modified:
   trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
   trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
   trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
Log:
JBMESSAGING-1413: We need to distinguish between a regular shutdown and removing queues

- added method undeployDestination(String) to JMSServerManager to remove the destination bindings from JNDI
- in JMSServerDeployer.undeploy(Node), called JMSServerManager.undeployDestination() instead of destroy{Queue|Topic}() so that the content of the queue is left untouched when a destination is undeployed

Modified: trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java	2008-09-30 20:37:23 UTC (rev 5054)
+++ trunk/src/main/org/jboss/messaging/jms/server/JMSServerManager.java	2008-10-01 08:27:34 UTC (rev 5055)
@@ -74,6 +74,18 @@
    boolean createTopic(String topicName, String jndiBinding) throws Exception;
 
    /**
+    * Remove the destination from JNDI.
+    * Calling this method does <em>not</em> destroy the destination.
+    * 
+    * @param name
+    *           the name of the destination to remove from JNDI
+    * @return true if removed
+    * @throws Exception
+    *            if a problem occurred removing the destination
+    */
+   boolean undeployDestination(String name) throws Exception;
+   
+   /**
     * destroys a queue and removes it from JNDI
     * 
     * @param name

Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2008-09-30 20:37:23 UTC (rev 5054)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2008-10-01 08:27:34 UTC (rev 5055)
@@ -444,14 +444,12 @@
       else if (node.getNodeName().equals(QUEUE_NODE_NAME))
       {
          String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
-         // TODO: https://jira.jboss.org/jira/browse/JBMESSAGING-1413
-         // jmsServerManager.destroyQueue(queueName);
+         jmsServerManager.undeployDestination(queueName);
       }
       else if (node.getNodeName().equals(TOPIC_NODE_NAME))
       {
          String topicName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
-         // TODO: https://jira.jboss.org/jira/browse/JBMESSAGING-1413
-         // jmsServerManager.destroyTopic(topicName);
+         jmsServerManager.undeployDestination(topicName);
       }
    }
 

Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java	2008-09-30 20:37:23 UTC (rev 5054)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java	2008-10-01 08:27:34 UTC (rev 5055)
@@ -148,8 +148,8 @@
       managementService.registerTopic(jBossTopic, jndiBinding, postOffice, storageManager);
       return added;
    }
-
-   public boolean destroyQueue(final String name) throws Exception
+   
+   public boolean undeployDestination(String name) throws Exception
    {
       List<String> jndiBindings = destinations.get(name);
       if (jndiBindings == null || jndiBindings.size() == 0)
@@ -160,6 +160,13 @@
       {
          initialContext.unbind(jndiBinding);
       }
+      return true;
+   }
+
+   public boolean destroyQueue(final String name) throws Exception
+   {
+      undeployDestination(name);
+      
       destinations.remove(name);
       managementService.unregisterQueue(name);
       postOffice.removeDestination(JBossQueue.createAddressFromName(name), false);
@@ -170,15 +177,8 @@
 
    public boolean destroyTopic(final String name) throws Exception
    {
-      List<String> jndiBindings = destinations.get(name);
-      if (jndiBindings == null || jndiBindings.size() == 0)
-      {
-         return false;
-      }
-      for (String jndiBinding : jndiBindings)
-      {
-         initialContext.unbind(jndiBinding);
-      }
+      undeployDestination(name);
+
       destinations.remove(name);
       managementService.unregisterTopic(name);
       postOffice.removeDestination(JBossTopic.createAddressFromName(name), false);




More information about the jboss-cvs-commits mailing list