List of utility methods to do MBean
Object | invoke(Logger logger, MBeanServer mbeanServer, ObjectName mbeanName, String methodName, Object... arguments) Utility method to invoke methods on MBeans. try { String[] signature; if (arguments != null) { signature = new String[arguments.length]; for (int i = 0; i < arguments.length; ++i) { signature[i] = arguments[i].getClass().getCanonicalName(); } else { ... |
Object | invoke(MBeanServer mbs, ObjectName name, String operationName, Object params[], String signature[]) invoke try { Object ret = mbs.invoke(name, operationName, params, signature); return ret; } catch (InstanceNotFoundException | MBeanException | ReflectionException ex) { throw new Error(ex); |
void | invokeStopOperation(ObjectName name, MBeanServer server) Invokes the stop() method of an MBean.
server.invoke(name, STOP_OPERATION_NAME, null, null); |
boolean | isRegistered(MBeanServer mbs, ObjectName objectName) is Registered return mbs.isRegistered(objectName);
|
boolean | isServerStarted(MBeanServerConnection server) Checks if Server is up using given MBean server connection. ObjectName serverMBeanName = new ObjectName("jboss.system:type=Server"); return ((Boolean) server.getAttribute(serverMBeanName, "Started")).booleanValue(); |
String | listMBeans(MBeanServerConnection mbsc, String objectNameStr) list M Beans StringBuffer sb = new StringBuffer(); ObjectName name = objectNameStr == null ? null : new ObjectName(objectNameStr); QueryExp query = null; Set objectNameSet = mbsc.queryNames(name, query); Iterator it = objectNameSet.iterator(); while (it.hasNext()) { ObjectName on = (ObjectName) it.next(); sb.append("-----------------"); ... |
ObjectName | makeMBeanName(@Nonnull final String domain, @Nonnull final String type, @Nonnull final String channelName) make M Bean Name final String mbeanName = makeMBeanNameString(domain, type, channelName); try { return new ObjectName(mbeanName); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException(e); } catch (NullPointerException e) { throw new IllegalArgumentException(e); |
String | makeSignatureString(MBeanParameterInfo[] info) make Signature String String[] sig = new String[info.length]; for (int i = 0; i < info.length; i++) { sig[i] = info[i].getType(); return makeSignatureString(sig); |
String | matchType(MBeanNotificationInfo aInfo, String aMatch) Method used to determine the type of notification to be released. String[] lTypes = aInfo.getNotifTypes(); for (String lType : lTypes) { if (lType.endsWith(aMatch)) { return lType; return lTypes[0]; |
String | mBeanAttributes2String(MBeanAttributeInfo[] attributeInfoArray) m Bean Attributes String StringBuilder sb = new StringBuilder("["); if (attributeInfoArray == null || attributeInfoArray.length == 0) { sb.append("]"); return sb.toString(); sb.append(attributeInfoArray[0].getName()); for (int i = 1; i < attributeInfoArray.length; ++i) { sb.append(",").append(attributeInfoArray[i].getName()); ... |