args[1] = name;
try {
Method getMethod = PrivilegedAccessHelper.getPublicMethod(MBeanServer.class,
"registerMBean", new Class[] {Object.class, ObjectName.class}, false);
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
info = (ObjectInstance) AccessController.doPrivileged(new PrivilegedMethodInvoker(getMethod, mBeanServerRuntime, args));
} else {
info = mBeanServerRuntime.registerMBean(developmentMBean, name);
}
} catch(InstanceAlreadyExistsException iaee) {
getAbstractSession().log(SessionLog.WARNING, SessionLog.SERVER, "problem_registering_mbean", iaee);
} catch (MBeanRegistrationException registrationProblem) {
getAbstractSession().log(SessionLog.WARNING, SessionLog.SERVER, "problem_registering_mbean", registrationProblem);
} catch (Exception e) {
getAbstractSession().log(SessionLog.WARNING, SessionLog.SERVER, "problem_registering_mbean", e);
}
getAbstractSession().log(SessionLog.FINEST, SessionLog.SERVER, "registered_mbean", info, mBeanServerRuntime);
}
if (null != mBeanServerRuntime && shouldRegisterRuntimeBean) {
try {
name = new ObjectName(JMX_REGISTRATION_PREFIX + "Session(" + sessionName + ")");
} catch (MalformedObjectNameException mne) {
getAbstractSession().log(SessionLog.WARNING, SessionLog.SERVER, "problem_registering_mbean", mne);
} catch (Exception exception) {
getAbstractSession().log(SessionLog.WARNING, SessionLog.SERVER, "problem_registering_mbean", exception);
}
ObjectInstance runtimeInstance = null;
try {
// The cached runtimeServicesMBean is a server platform specific instance
Object[] args = new Object[2];
args[0] = runtimeServicesMBean;
args[1] = name;
Method getMethod = PrivilegedAccessHelper.getPublicMethod(MBeanServer.class,
"registerMBean", new Class[] {Object.class, ObjectName.class}, false);
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
runtimeInstance = (ObjectInstance) AccessController.doPrivileged(new PrivilegedMethodInvoker(getMethod, mBeanServerRuntime, args));
} else {
runtimeInstance = mBeanServerRuntime.registerMBean(runtimeServicesMBean, name);
}
setRuntimeServicesMBean(runtimeServicesMBean);
} catch(InstanceAlreadyExistsException iaee) {