Package org.jboss.mx.remote.event

Source Code of org.jboss.mx.remote.event.LocalMBeanEventFilter

package org.jboss.mx.remote.event;

import javax.management.MBeanServerNotification;
import javax.management.Notification;
import javax.management.NotificationFilter;
import javax.management.ObjectName;

/**
* LocalMBeanEventFilter will filter out events that don't originate from the local MBeanServer
*
* @author <a href="mailto:jhaynie@vocalocity.net">Jeff Haynie</a>
*/
public class LocalMBeanEventFilter implements NotificationFilter
{
    static final long serialVersionUID = 5891412135761783128L;

    public boolean isNotificationEnabled(Notification notification)
    {
        Object src = notification.getSource();
        ObjectName on = null;
        if (notification instanceof MBeanServerNotification)
        {
            MBeanServerNotification mb = (MBeanServerNotification) notification;
            on = mb.getMBeanName();
        }
        else if (src instanceof ObjectName)
        {
            on = (ObjectName) src;
        }
        return (on == null || on.getKeyProperty("MBeanServerId") == null);
    }
}
TOP

Related Classes of org.jboss.mx.remote.event.LocalMBeanEventFilter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.