List of utility methods to do MBean
MBeanServerConnection | getMbeanServerConnection(final JMXConnector jmxConnector) get Mbean Server Connection MBeanServerConnection mBeanServerConnection = null; if (jmxConnector != null) { try { mBeanServerConnection = jmxConnector.getMBeanServerConnection(); } catch (final IOException e) { e.printStackTrace(); return mBeanServerConnection; |
MBeanServerConnection | getMBeanServerConnectionForJMXClient() get M Bean Server Connection For JMX Client JMXServiceURL jmxURL = new JMXServiceURL(getJMXRMIServiceURL()); JMXConnector _jmxConnector = JMXConnectorFactory.connect(jmxURL); return _jmxConnector.getMBeanServerConnection(); |
ObjectName | getMBeanServerDelegateName() Lookup the server delegate name, which works for sure for Java 1.6 but maye not for Java 1.5. try { return MBeanServerDelegate.DELEGATE_NAME; } catch (NoSuchFieldError error) { return newObjectName("JMImplementation:type=MBeanServerDelegate"); |
String | getMBeanServerId(final MBeanServer aMBeanServer) Get the MBeanServerId of Agent ID for the provided MBeanServer. String serverId = null; final String SERVER_DELEGATE = "JMImplementation:type=MBeanServerDelegate"; final String MBEAN_SERVER_ID_KEY = "MBeanServerId"; try { ObjectName delegateObjName = new ObjectName(SERVER_DELEGATE); serverId = (String) aMBeanServer.getAttribute(delegateObjName, MBEAN_SERVER_ID_KEY); } catch (MalformedObjectNameException malformedObjectNameException) { } catch (AttributeNotFoundException noMatchingAttrException) { ... |
ObjectName | getMBeanServerObjectName() get the ObjectName of the MBeanServer if (mbeanserver == null) { mbeanserver = new ObjectName("JMImplementation:type=MBeanServerDelegate"); return mbeanserver; |
MBeanOperationInfo | getOperation(MBeanInfo info, String opName) Returns the first operation with the specified name. MBeanOperationInfo[] ops = info.getOperations(); for (int i = 0; i < ops.length; i++) { if (ops[i].getName().equals(opName)) return ops[i]; return null; |
T | getProxy(MBeanServerConnection connection, ObjectName objectName, final Class get Proxy return JMX.newMBeanProxy(connection, objectName, objectClass, true);
|
String | getServerId(MBeanServer server) get the MBeanServerId attribute from the server if (server == null) { throw new NullPointerException("MBeanServer is null"); if (mbeanserver == null) { mbeanserver = new ObjectName("JMImplementation:type=MBeanServerDelegate"); return (String) server.getAttribute(mbeanserver, "MBeanServerId"); |
boolean | infoArrayEquals(MBeanParameterInfo[] a, MBeanParameterInfo[] a2) info Array Equals if (a == a2) return true; if (a == null || a2 == null) return false; int length = a.length; if (a2.length != length) return false; for (int i = 0; i < length; i++) { ... |
boolean | infoEquals(MBeanInfo one, MBeanInfo two) info Equals if (one == two) return true; if (!safeStringEquals(one.getClassName(), two.getClassName()) || !safeStringEquals(one.getDescription(), two.getDescription())) return false; return true; |