Search in sources :

Example 1 with IMBeanNotification

use of org.talend.designer.runtime.visualization.MBean.IMBeanNotification in project tdi-studio-se by Talend.

the class MBeanNotification method clear.

/*
     * @see IMBeanNotification#clear(ObjectName)
     */
@Override
public void clear(ObjectName objectName) {
    List<Notification> notification = notifications.get(objectName);
    if (notification == null) {
        return;
    }
    notification.clear();
    JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmModified, activeJvm));
}
Also used : JvmModelEvent(org.talend.designer.runtime.visualization.JvmModelEvent) Notification(javax.management.Notification) IMBeanNotification(org.talend.designer.runtime.visualization.MBean.IMBeanNotification)

Example 2 with IMBeanNotification

use of org.talend.designer.runtime.visualization.MBean.IMBeanNotification in project tdi-studio-se by Talend.

the class MBeanNotification method subscribe.

/*
     * @see IMBeanNotification#subscribe(ObjectName)
     */
@Override
public void subscribe(final ObjectName objectName) throws JvmCoreException {
    NotificationListener listener = new NotificationListener() {

        @Override
        public void handleNotification(Notification notification, Object handback) {
            List<Notification> list = notifications.get(objectName);
            if (list == null) {
                list = new ArrayList<Notification>();
            }
            list.add(new DecoratedNotification(notification));
            notifications.put(objectName, list);
        }
    };
    activeJvm.getMBeanServer().addNotificationListener(objectName, listener);
    listeners.put(objectName, listener);
    JvmModel.getInstance().fireJvmModelChangeEvent(new JvmModelEvent(State.JvmModified, activeJvm));
}
Also used : JvmModelEvent(org.talend.designer.runtime.visualization.JvmModelEvent) Notification(javax.management.Notification) IMBeanNotification(org.talend.designer.runtime.visualization.MBean.IMBeanNotification) NotificationListener(javax.management.NotificationListener)

Aggregations

Notification (javax.management.Notification)2 JvmModelEvent (org.talend.designer.runtime.visualization.JvmModelEvent)2 IMBeanNotification (org.talend.designer.runtime.visualization.MBean.IMBeanNotification)2 NotificationListener (javax.management.NotificationListener)1