Search in sources :

Example 16 with MBeanServerNotification

use of javax.management.MBeanServerNotification in project logging-log4j2 by apache.

the class ClientGui method handleNotificationInAwtEventThread.

private void handleNotificationInAwtEventThread(final Notification notif, final Object paramObject) {
    if (StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE.equals(notif.getType())) {
        if (!(paramObject instanceof ObjectName)) {
            handle("Invalid notification object type", new ClassCastException(paramObject.getClass().getName()));
            return;
        }
        final ObjectName param = (ObjectName) paramObject;
        final JTextArea text = statusLogTextAreaMap.get(param);
        if (text != null) {
            text.append(notif.getMessage() + '\n');
        }
        return;
    }
    if (notif instanceof MBeanServerNotification) {
        final MBeanServerNotification mbsn = (MBeanServerNotification) notif;
        final ObjectName mbeanName = mbsn.getMBeanName();
        if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notif.getType())) {
            onMBeanRegistered(mbeanName);
        } else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(notif.getType())) {
            onMBeanUnregistered(mbeanName);
        }
    }
}
Also used : JTextArea(javax.swing.JTextArea) MBeanServerNotification(javax.management.MBeanServerNotification) ObjectName(javax.management.ObjectName)

Aggregations

MBeanServerNotification (javax.management.MBeanServerNotification)16 ObjectName (javax.management.ObjectName)9 Notification (javax.management.Notification)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 TargetedNotification (javax.management.remote.TargetedNotification)2 ArrayNotificationBuffer (com.sun.jmx.remote.internal.ArrayNotificationBuffer)1 NotificationBuffer (com.sun.jmx.remote.internal.NotificationBuffer)1 NotificationBufferFilter (com.sun.jmx.remote.internal.NotificationBufferFilter)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 GregorianCalendar (java.util.GregorianCalendar)1 List (java.util.List)1 Map (java.util.Map)1 AttributeChangeNotification (javax.management.AttributeChangeNotification)1 AttributeNotFoundException (javax.management.AttributeNotFoundException)1 InstanceNotFoundException (javax.management.InstanceNotFoundException)1 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)1 JMException (javax.management.JMException)1 JMRuntimeException (javax.management.JMRuntimeException)1