Java Utililty Methods MBean

List of utility methods to do MBean

Description

The list of methods to do MBean are organized into topic(s).

Method

voidregisterMBean(Object bean, MBeanServer mBeanServer, ObjectName objectName)
register M Bean
if (!mBeanServer.isRegistered(objectName)) {
    mBeanServer.registerMBean(bean, objectName);
} else {
    unregisterMBean(mBeanServer, objectName);
    mBeanServer.registerMBean(bean, objectName);
voidremoveTimerNotification(ObjectName timer, Integer id, MBeanServer server)
remove Timer Notification
server.invoke(timer, REMOVE_NOTIFICATION_OPERATION_NAME, new Object[] { id },
        REMOVE_NOTIFICATION_SIGNATURE);
ClassLoaderresolveServerClassLoader(Map env, MBeanServer mbs)
Get the Connector Server default class loader.
if (env == null)
    return Thread.currentThread().getContextClassLoader();
Object loader = env.get(DEFAULT_CLASS_LOADER);
Object name = env.get(DEFAULT_CLASS_LOADER_NAME);
if (loader != null && name != null) {
    final String msg = "Only one of " + DEFAULT_CLASS_LOADER + " or " + DEFAULT_CLASS_LOADER_NAME
            + " should be specified.";
    throw new IllegalArgumentException(msg);
...
MBeanServersetQueryExpServer(QueryExp query, MBeanServer toSet)
Set the mbean server on the QueryExp and try and pass back any previously set one
MBeanServer result = QueryEval.getMBeanServer();
query.setMBeanServer(toSet);
return result;
StringtoString(MBeanParameterInfo[] pinfo)
to String
StringBuffer sb = new StringBuffer();
for (int i = 0; i < pinfo.length; i++) {
    if (sb.length() != 0) {
        sb.append(", ");
    sb.append(pinfo[i].getType());
sb.insert(0, '(');
...
StringunregisterMBean(MBeanServer mbs, ObjectName name)
unregister M Bean
if (name == null) {
    return null;
try {
    mbs.unregisterMBean(name);
    return null;
} catch (InstanceNotFoundException | MBeanRegistrationException ex) {
    return ex.getMessage();
...