# HG changeset patch # User jbachorik # Date 1427902228 -7200 # Node ID e803266598cbf4b01b30f1750efbcc8d726ba0c1 # Parent 7bc1eec6ce3b24ec7680cc514f239463efc90031 8076397: Better MBean connections Reviewed-by: dfuchs, ahgross diff -r 7bc1eec6ce3b -r e803266598cb jdk/src/java.management/share/classes/javax/management/MBeanServerInvocationHandler.java --- a/jdk/src/java.management/share/classes/javax/management/MBeanServerInvocationHandler.java Tue Apr 07 13:37:30 2015 +0300 +++ b/jdk/src/java.management/share/classes/javax/management/MBeanServerInvocationHandler.java Wed Apr 01 17:30:28 2015 +0200 @@ -141,6 +141,12 @@ if (connection == null) { throw new IllegalArgumentException("Null connection"); } +// if (Proxy.isProxyClass(connection.getClass())) { +// if (MBeanServerInvocationHandler.class.isAssignableFrom( +// Proxy.getInvocationHandler(connection).getClass())) { +// throw new IllegalArgumentException("Wrapping MBeanServerInvocationHandler"); +// } +// } if (objectName == null) { throw new IllegalArgumentException("Null object name"); } @@ -418,6 +424,10 @@ new Class[] {Object.class}) && isLocal(proxy, method)) return true; +// if (methodName.equals("finalize") +// && method.getParameterTypes().length == 0) { +// return true; +// } return false; } @@ -453,6 +463,9 @@ connection + "[" + objectName + "])"; } else if (methodName.equals("hashCode")) { return objectName.hashCode()+connection.hashCode(); + } else if (methodName.equals("finalize")) { + // ignore the finalizer invocation via proxy + return null; } throw new RuntimeException("Unexpected method name: " + methodName);