BaseModelMBean.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:lazycat 作者:
/**
 * Add a notification event listener to this MBean.
 *
 * @param listener
 *            Listener that will receive event notifications
 * @param filter
 *            Filter object used to filter event notifications actually
 *            delivered, or <code>null</code> for no filtering
 * @param handback
 *            Handback object to be sent along with event notifications
 *
 * @exception IllegalArgumentException
 *                if the listener parameter is null
 */
@Override
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
        throws IllegalArgumentException {

    if (listener == null)
        throw new IllegalArgumentException("Listener is null");

    if (log.isDebugEnabled())
        log.debug("addNotificationListener " + listener);

    if (generalBroadcaster == null)
        generalBroadcaster = new BaseNotificationBroadcaster();
    generalBroadcaster.addNotificationListener(listener, filter, handback);

    // We'll send the attribute change notifications to all listeners ( who
    // care )
    // The normal filtering can be used.
    // The problem is that there is no other way to add attribute change
    // listeners
    // to a model mbean ( AFAIK ). I suppose the spec should be fixed.
    if (attributeBroadcaster == null)
        attributeBroadcaster = new BaseNotificationBroadcaster();

    if (log.isDebugEnabled())
        log.debug("addAttributeNotificationListener " + listener);

    attributeBroadcaster.addNotificationListener(listener, filter, handback);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号