[jboss-cvs] JBossAS SVN: r64012 - trunk/cluster/src/main/org/jboss/ha/jmx.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 12 16:41:49 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-07-12 16:41:49 -0400 (Thu, 12 Jul 2007)
New Revision: 64012

Modified:
   trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
Log:
[JBAS-4544] Add setServiceHAName

Modified: trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java	2007-07-12 20:18:03 UTC (rev 64011)
+++ trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java	2007-07-12 20:41:49 UTC (rev 64012)
@@ -26,6 +26,7 @@
 
 import javax.management.AttributeChangeNotification;
 import javax.management.Notification;
+import javax.management.ObjectName;
 
 import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
 import org.jboss.ha.framework.interfaces.DistributedState;
@@ -71,6 +72,8 @@
    private boolean sendLocalLifecycleNotifications = true;
    private boolean sendRemoteLifecycleNotifications = true;
    
+   private String serviceHAName;
+   
    // Public --------------------------------------------------------
 
    public HAServiceMBeanSupport()
@@ -433,8 +436,28 @@
     */
    public String getServiceHAName()
    {
-      return getServiceName().getCanonicalName();
+      if (serviceHAName == null)
+      {
+         ObjectName on = getServiceName();
+         if (on != null)
+         {
+            serviceHAName = on.getCanonicalName();
+         }
+         else
+         {
+            // TODO JBAS-4543
+            throw new IllegalStateException("Cannot determine ServiceHAName; " +
+                    "either set it explicitly or register this object in JMX " +
+                    "before calling create");
+         }
+      }
+      return serviceHAName;
    }
+   
+   public void setServiceHAName(String haName)
+   {
+      this.serviceHAName = haName;
+   }
 
    // Private -------------------------------------------------------
 




More information about the jboss-cvs-commits mailing list