Example usage for javax.management.relation MBeanServerNotificationFilter disableObjectName

List of usage examples for javax.management.relation MBeanServerNotificationFilter disableObjectName

Introduction

In this page you can find the example usage for javax.management.relation MBeanServerNotificationFilter disableObjectName.

Prototype

public synchronized void disableObjectName(ObjectName objectName) throws IllegalArgumentException 

Source Link

Document

Disables MBeanServerNotifications concerning given ObjectName.

Usage

From source file:org.mule.providers.jmx.JmxEndpointBuilder.java

private void setNotificationMBeans(MBeanServerNotificationFilter filter, String[] onames)
        throws MalformedObjectNameException {
    if (onames.length == 0)
        return;//from  ww  w.  j av a  2s . c om
    if (onames[0].equals("!*")) {
        filter.disableAllObjectNames();
    }
    for (String oname : onames) {
        boolean shallEnable = !oname.startsWith("!");
        if (shallEnable) {
            oname = oname.substring(1);
        }
        if ("*".equals(oname)) {
            if (shallEnable) {
                filter.enableAllObjectNames();
            } else {
                filter.disableAllObjectNames();
            }
            continue;
        }
        try {
            ObjectName objName = new ObjectName(oname);
            if (shallEnable) {
                filter.enableObjectName(objName);
            } else {
                filter.disableObjectName(objName);
            }
        } catch (Exception e) {
            logger.warn("Could not " + (shallEnable ? "enable" : "disable") + " " + oname, e);
        }
    }
}