Methods Summary |
---|
synchronized void | addReference(javax.management.ObjectName name, java.lang.Object mxbean)
mxbeanToObjectName.put(mxbean, name);
|
static com.sun.jmx.mbeanserver.MXBeanLookup | lookupFor(javax.management.MBeanServerConnection mbsc)
synchronized (mbscToLookup) {
WeakReference<MXBeanLookup> weakLookup = mbscToLookup.get(mbsc);
MXBeanLookup lookup = (weakLookup == null) ? null : weakLookup.get();
if (lookup == null) {
lookup = new MXBeanLookup(mbsc);
mbscToLookup.put(mbsc, new WeakReference<MXBeanLookup>(lookup));
}
return lookup;
}
|
synchronized javax.management.ObjectName | mxbeanToObjectName(java.lang.Object mxbean)
if (mxbean instanceof Proxy) {
InvocationHandler ih = Proxy.getInvocationHandler(mxbean);
if (ih instanceof MBeanServerInvocationHandler) {
MBeanServerInvocationHandler mbsih =
(MBeanServerInvocationHandler) ih;
if (mbsih.getMBeanServerConnection().equals(mbsc))
return mbsih.getObjectName();
}
return null;
} else
return mxbeanToObjectName.get(mxbean);
|
synchronized T | objectNameToMXBean(javax.management.ObjectName name, java.lang.Class type)
WeakReference<Object> wr = objectNameToProxy.get(name);
if (wr != null) {
Object proxy = wr.get();
if (type.isInstance(proxy))
return type.cast(proxy);
}
InvocationHandler handler =
new MBeanServerInvocationHandler(mbsc, name);
T proxy = JMX.newMXBeanProxy(mbsc, name, type);
objectNameToProxy.put(name, new WeakReference<Object>(proxy));
return proxy;
|
synchronized boolean | removeReference(javax.management.ObjectName name, java.lang.Object mxbean)
if (name.equals(mxbeanToObjectName.get(mxbean))) {
mxbeanToObjectName.remove(mxbean);
return true;
} else
return false;
/* removeReference can be called when the above condition fails,
* notably if you try to register the same MXBean twice.
*/
|