hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r321056 - /jakarta/hivemind/branches/branch-1-1/jmx/src/java/org/apache/hivemind/management/log4j/LoggerMBean.java
Date Fri, 14 Oct 2005 08:23:44 GMT
Author: ahuegen
Date: Fri Oct 14 01:23:39 2005
New Revision: 321056

URL: http://svn.apache.org/viewcvs?rev=321056&view=rev
Log:
Fixed multiple appender registration

Modified:
    jakarta/hivemind/branches/branch-1-1/jmx/src/java/org/apache/hivemind/management/log4j/LoggerMBean.java

Modified: jakarta/hivemind/branches/branch-1-1/jmx/src/java/org/apache/hivemind/management/log4j/LoggerMBean.java
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/branches/branch-1-1/jmx/src/java/org/apache/hivemind/management/log4j/LoggerMBean.java?rev=321056&r1=321055&r2=321056&view=diff
==============================================================================
--- jakarta/hivemind/branches/branch-1-1/jmx/src/java/org/apache/hivemind/management/log4j/LoggerMBean.java
(original)
+++ jakarta/hivemind/branches/branch-1-1/jmx/src/java/org/apache/hivemind/management/log4j/LoggerMBean.java
Fri Oct 14 01:23:39 2005
@@ -246,6 +246,10 @@
         }
     }
 
+    /**
+     * Register a mbean for an appender.
+     * @param appender
+     */
     void registerAppenderMBean(Appender appender)
     {
         String name = appender.getName();
@@ -253,13 +257,16 @@
         ObjectName objectName = null;
         try
         {
-            AppenderDynamicMBean appenderMBean = new AppenderDynamicMBean(appender);
             objectName = new ObjectName("log4j", "appender", name);
-            getMBeanServer().registerMBean(appenderMBean, objectName);
-
-            _attributes
-                    .add(new MBeanAttributeInfo("appender=" + name, "javax.management.ObjectName",
-                            "The " + name + " appender.", true, true, false));
+            // register appender as mbean if not already existing
+            if (!getMBeanServer().isRegistered(objectName)) {
+                AppenderDynamicMBean appenderMBean = new AppenderDynamicMBean(appender);
+                getMBeanServer().registerMBean(appenderMBean, objectName);
+    
+                _attributes
+                        .add(new MBeanAttributeInfo("appender=" + name, "javax.management.ObjectName",
+                                "The " + name + " appender.", true, true, false));
+            }
 
         }
         catch (Exception e)



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org


Mime
View raw message