karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [1/2] git commit: [KARAF-2849] MBeanServer unregistration is not correctly handled
Date Mon, 24 Mar 2014 09:56:11 GMT
Repository: karaf
Updated Branches:
  refs/heads/master 0e8440651 -> 725d4b79d


[KARAF-2849] MBeanServer unregistration is not correctly handled


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/3a1fc529
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/3a1fc529
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/3a1fc529

Branch: refs/heads/master
Commit: 3a1fc529aa08277feed78f18156eab3a5a0e3772
Parents: 0e84406
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Mon Mar 24 10:40:09 2014 +0100
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Mon Mar 24 10:51:32 2014 +0100

----------------------------------------------------------------------
 .../management/boot/KarafMBeanServerBuilder.java      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/3a1fc529/management/boot/src/main/java/org/apache/karaf/management/boot/KarafMBeanServerBuilder.java
----------------------------------------------------------------------
diff --git a/management/boot/src/main/java/org/apache/karaf/management/boot/KarafMBeanServerBuilder.java
b/management/boot/src/main/java/org/apache/karaf/management/boot/KarafMBeanServerBuilder.java
index ad84235..9c5e014 100644
--- a/management/boot/src/main/java/org/apache/karaf/management/boot/KarafMBeanServerBuilder.java
+++ b/management/boot/src/main/java/org/apache/karaf/management/boot/KarafMBeanServerBuilder.java
@@ -62,6 +62,20 @@ public class KarafMBeanServerBuilder extends MBeanServerBuilder {
                 }
                 guard.invoke(proxy, method, args);
             }
+            if (method.getName().equals("equals")
+                    && method.getParameterTypes().length == 1
+                    && method.getParameterTypes()[0] == Object.class) {
+                Object target = args[0];
+                if (target != null && Proxy.isProxyClass(target.getClass())) {
+                    InvocationHandler handler = Proxy.getInvocationHandler(target);
+                    if (handler instanceof MBeanInvocationHandler) {
+                        args[0] = ((MBeanInvocationHandler) handler).wrapped;
+                    }
+                }
+            } else if (method.getName().equals("finalize") && method.getParameterTypes().length
== 0) {
+                // special case finalize, don't route through to delegate because that will
get its own call
+                return null;
+            }
             try {
                 return method.invoke(wrapped, args);
             } catch (InvocationTargetException ite) {


Mime
View raw message