[jboss-cvs] JBoss Messaging SVN: r8565 - branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1911_JBMESSAGING-1912_JBMESSAGING-1918_JBMESSAGING_1921_JBMESSAGING_1922_JBMESSAGING_1931/src/main/org/jboss/jms/server.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 8 11:54:47 EDT 2012


Author: dgrove_redhat.com
Date: 2012-10-08 11:54:47 -0400 (Mon, 08 Oct 2012)
New Revision: 8565

Modified:
   branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1911_JBMESSAGING-1912_JBMESSAGING-1918_JBMESSAGING_1921_JBMESSAGING_1922_JBMESSAGING_1931/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
Log:
JBMESSAGING-1935

Modified: branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1911_JBMESSAGING-1912_JBMESSAGING-1918_JBMESSAGING_1921_JBMESSAGING_1922_JBMESSAGING_1931/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
===================================================================
--- branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1911_JBMESSAGING-1912_JBMESSAGING-1918_JBMESSAGING_1921_JBMESSAGING_1922_JBMESSAGING_1931/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java	2012-08-30 15:53:07 UTC (rev 8564)
+++ branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1911_JBMESSAGING-1912_JBMESSAGING-1918_JBMESSAGING_1921_JBMESSAGING_1922_JBMESSAGING_1931/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java	2012-10-08 15:54:47 UTC (rev 8565)
@@ -28,12 +28,17 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.management.JMX;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
 import javax.management.ObjectName;
 
+import org.jboss.deployment.MainDeployerMBean;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.contract.PersistenceManager;
 import org.jboss.messaging.core.impl.postoffice.MessagingPostOffice;
 import org.jboss.messaging.util.JMXAccessor;
+import org.jboss.mx.util.ObjectNameFactory;
 import org.jboss.system.ServiceMBeanSupport;
 
 /**
@@ -117,6 +122,9 @@
       
       nodeRecovery.start();
       
+      // stop deployments
+      stopDeployments();
+      
       log.info("JBM node is stopped.");
    }
 
@@ -249,7 +257,7 @@
       log.info("JBM node restarted.");
       
       // restart message delivery to MDBs
-      restartAllMDBs();
+//      restartAllMDBs();
    }
    
    private void makeSureDelay()
@@ -351,21 +359,46 @@
 
    /**
     * Restart delivery to all MDBs
+    * 
+    * Need all classes that are "MessagingDelegateWrapper"
+    *
+    * 9/25/2012 - DCG - I deprecated this method.  I was going to remove it, but
+    * it might yet be useful.  It turns out that restarting message delivery was
+    * not sufficient to re-enable MDBs.
+    * 
     */
+   @SuppressWarnings("unused")
+   @Deprecated
    private void restartAllMDBs() {
       Set<ObjectName> mbeanNames = server.queryNames(null, null);
       for (ObjectName objName: mbeanNames) {
             try
             {
+               if (server.isInstanceOf(objName, "org.jboss.ejb3.mdb.MessagingDelegateWrapper"))
+                  log.debug("Found MessagingDelegateWrapper: " + objName.getCanonicalName());
+               else
+                  continue;
+
                server.invoke(objName, "stopDelivery", new Object[] {}, null);
                server.invoke(objName, "startDelivery", new Object[] {}, null);
-               log.debug("Restarted Delivery for: " + objName.getCanonicalName());
+               log.debug("Restarted: " + objName.getCanonicalName());
             }
-            catch(Exception e)
+            catch (Exception e)
             {
-               log.trace("Restarting message delivery on: " + objName.getCanonicalName() + " produced:");
-               log.trace(e);
+               log.warn("Exception on restart: ", e);
             }
       }
    }
+   
+   /**
+    * 
+    */
+   private void stopDeployments() {
+      // **** get the server and lookup the deployer
+      MBeanServerConnection server = (MBeanServerConnection)MBeanServerFactory.findMBeanServer(null).get(0);
+      ObjectName objectName = ObjectNameFactory.create("jboss.system:service=MainDeployer");
+      MainDeployerMBean mainDeployer = JMX.newMBeanProxy(server, objectName, MainDeployerMBean.class);
+      
+      mainDeployer.shutdown();
+   }
 }



More information about the jboss-cvs-commits mailing list