MBeanServer mbeanServer = getServer();
Element element = Util.stringToElement(destinationMBeanConfig);
ServiceCreator sc = new ServiceCreator(mbeanServer);
ClassLoader cl = this.getClass().getClassLoader();
ObjectName loaderObjectName = null;
try
{
// Try reflection for getObjectName on the class loader
Class[] sig = {};
Method getObjectName = cl.getClass().getMethod("getObjectName", sig);
Object[] args = {};
loaderObjectName = (ObjectName) getObjectName.invoke(cl, args);
}
catch(Throwable e)
{
if(log.isTraceEnabled())
log.trace("Failed to find/invoke getObjectName", e);
}
sc.install(on, loaderObjectName, element);
// inject dependencies
mbeanServer.setAttribute(on, new Attribute("ServerPeer", getServiceName()));
mbeanServer.setAttribute(on, new Attribute("JNDIName", jndiName));
if (params)