List of utility methods to do MBean
T | newMBeanProxy(final MBeanServerConnection conn, final ObjectName objectName, final Class This method allows you to get at a bean registered with the server. return (T) MBeanServerInvocationHandler.newProxyInstance(conn, objectName, interfaceClass, false);
|
ObjectName | objectNameFor(Logger logger, String mbeanName) Generates an ObjectName object for a mbean name supplied as String. try { return new ObjectName(mbeanName); } catch (Throwable ex) { logger.warn("Could not create object name.", ex); return null; |
ObjectName | onameForBean(final Object mbean, final String name) oname For Bean @SuppressWarnings("UseOfObsoleteCollectionType") Hashtable<String, String> ht = new Hashtable<String, String>(); Class klass = mbean.getClass(); ht.put("class", klass.getSimpleName()); ht.put("name", name); return new ObjectName(klass.getPackage().getName(), ht); |
boolean | operationEquals(MBeanOperationInfo one, MBeanOperationInfo two) operation Equals if (one == two) return true; return (one.getName().equals(two.getName()) && one.getReturnType().equals(two.getReturnType()) && one.getDescription().equals(two.getDescription()) && one.getImpact() == two.getImpact() && infoArrayEquals(one.getSignature(), two.getSignature()) ); |
boolean | paramEquals(MBeanParameterInfo o1, MBeanParameterInfo o2) param Equals if (o1 == o2) return true; return (o1.getName().equals(o2.getName()) && o1.getType().equals(o2.getType()) && safeEquals( o1.getDescription(), o2.getDescription()) ); |
T | queryAndGetAttribute(MBeanServerConnection connection, String domain, String name, String type, String scope, String attribute) query And Get Attribute return queryAndGetAttribute(connection, getObjectName(domain, name, type, scope), attribute);
|
Set | queryConnectionBy(MBeanServerConnection connection, ObjectName objectName) query Connection By return connection.queryMBeans(objectName, null);
|
Object | readAttribute(MBeanServer mbeanServer, String mbeanName, String attributeName) read Attribute try { ObjectName objectName = new ObjectName(mbeanName); return readAttribute(mbeanServer, objectName, attributeName); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException(e); |
ObjectInstance | registerMBean(MBeanServer mbs, Object object, ObjectName name, boolean unreg) register M Bean if (unreg) { if (mbs.isRegistered(name)) { unregisterMBean(mbs, name); try { ObjectInstance ret = mbs.registerMBean(object, name); return ret; ... |
ObjectName | registerMBean(MBeanServer server, String agentName, Map register M Bean StringBuilder sb = new StringBuilder(agentName).append(':'); for (String key : attrs.keySet()) { sb.append(key).append('=').append(attrs.get(key)).append(','); if (sb.charAt(sb.length() - 1) == ',') { sb.deleteCharAt(sb.length() - 1); ObjectName oName = new ObjectName(sb.toString()); ... |