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

Objectinvoke(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 {
...
Objectinvoke(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);
voidinvokeStopOperation(ObjectName name, MBeanServer server)
Invokes the stop() method of an MBean.
server.invoke(name, STOP_OPERATION_NAME, null, null);
booleanisRegistered(MBeanServer mbs, ObjectName objectName)
is Registered
return mbs.isRegistered(objectName);
booleanisServerStarted(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();
StringlistMBeans(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("-----------------");
...
ObjectNamemakeMBeanName(@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);
StringmakeSignatureString(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);
StringmatchType(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];
StringmBeanAttributes2String(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());
...