Example usage for javax.management.relation MBeanServerNotificationFilter disableAllObjectNames

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

Introduction

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

Prototype

public synchronized void disableAllObjectNames() 

Source Link

Document

Disables any MBeanServerNotification (all ObjectNames are deselected).

Usage

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

private void setNotificationMBeans(MBeanServerNotificationFilter filter, String[] onames)
        throws MalformedObjectNameException {
    if (onames.length == 0)
        return;/* w  w  w . j av  a 2 s.  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);
        }
    }
}