/** * We need to override this because by default equals returns false when * called on the proxy object and then relayed here. */ public boolean equals(Object that) { if (that == null) return false; if (that == this) return true; // check if 'that' is an MBeanProxyExt or a Proxy instance // that implements the MBeanProxyInstance interface if (that instanceof MBeanProxyInstance) { MBeanProxyInstance proxy = (MBeanProxyInstance) that; // assume equality if both the MBeanServer and ObjectName match if (name.equals(proxy.getMBeanProxyObjectName()) && server.equals(proxy.getMBeanProxyMBeanServer())) { return true; } } return false; }