aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1143049 - in /aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard: JmxWhiteboardSupport.java MBeanHolder.java
Date Tue, 05 Jul 2011 13:23:58 GMT
Author: not
Date: Tue Jul  5 13:23:58 2011
New Revision: 1143049

URL: http://svn.apache.org/viewvc?rev=1143049&view=rev
Log:
ARIES-701 Commit patch to use an identity hash map to cash mbean to mbean holder mappings.
Patch provided by fmeschbe

Modified:
    aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupport.java
    aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/MBeanHolder.java

Modified: aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupport.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupport.java?rev=1143049&r1=1143048&r2=1143049&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupport.java
(original)
+++ aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupport.java
Tue Jul  5 13:23:58 2011
@@ -20,7 +20,7 @@ package org.apache.aries.jmx.whiteboard;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
+import java.util.IdentityHashMap;
 
 import javax.management.MBeanRegistration;
 import javax.management.MBeanServer;
@@ -40,7 +40,8 @@ class JmxWhiteboardSupport {
 
     private MBeanServer[] mbeanServers = new MBeanServer[0];
 
-    private final HashMap<MBeanHolder, MBeanHolder> mbeans = new HashMap<MBeanHolder,
MBeanHolder>();
+    // mapping registered MBean services to their MBeanHolder objects
+    private final IdentityHashMap<Object, MBeanHolder> mbeans = new IdentityHashMap<Object,
MBeanHolder>();
 
     protected synchronized void addMBeanServer(final MBeanServer mbeanServer) {
 
@@ -83,7 +84,7 @@ class JmxWhiteboardSupport {
             for (MBeanServer mbeanServer : mbeanServers) {
                 holder.register(mbeanServer);
             }
-            mbeans.put(holder, holder);
+            mbeans.put(mbean, holder);
         }
     }
 
@@ -91,7 +92,7 @@ class JmxWhiteboardSupport {
 
         log.debug("unregisterMBean: Removing MBean {}", mbean);
 
-        final MBeanHolder holder = mbeans.remove(new MBeanHolder(mbean, null));
+        final MBeanHolder holder = mbeans.remove(mbean);
         if (holder != null) {
             holder.unregister();
         }

Modified: aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/MBeanHolder.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/MBeanHolder.java?rev=1143049&r1=1143048&r2=1143049&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/MBeanHolder.java
(original)
+++ aries/trunk/jmx/jmx-whiteboard/src/main/java/org/apache/aries/jmx/whiteboard/MBeanHolder.java
Tue Jul  5 13:23:58 2011
@@ -90,24 +90,4 @@ final class MBeanHolder {
                 + name, e);
         }
     }
-
-    // ---------- Object Overwrite
-
-    @Override
-    public int hashCode() {
-        return mbean.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        } else if (obj == this) {
-            return true;
-        } else if (obj instanceof MBeanHolder) {
-            return mbean == ((MBeanHolder) obj).mbean;
-        }
-
-        return false;
-    }
 }



Mime
View raw message