Search in sources :

Example 71 with Notification

use of javax.management.Notification in project groovy by apache.

the class JmxEventEmitter method send.

/**
     * Called to broadcast message on MBeanServer event bus.  Internally, it calls
     * NotificationBroadCasterSupport.sendNotification() method to dispatch the event.
     *
     * @param data - a data object sent as part of the event parameter.
     * @return a sequence number associated with the emitted event.
     */
public long send(Object data) {
    long seq = NumberSequencer.getNextSequence();
    Notification note = new Notification(this.getEvent(), this, seq, System.currentTimeMillis(), "Event notification " + this.getEvent());
    note.setUserData(data);
    super.sendNotification(note);
    return seq;
}
Also used : Notification(javax.management.Notification)

Example 72 with Notification

use of javax.management.Notification in project camel by apache.

the class SimpleBean method touch.

public void touch() {
    Notification n = new Notification("touched", this, mSequence++, mTimestamp, "I was touched");
    sendNotification(n);
}
Also used : JMXConnectionNotification(javax.management.remote.JMXConnectionNotification) MBeanServerNotification(javax.management.MBeanServerNotification) TimerNotification(javax.management.timer.TimerNotification) AttributeChangeNotification(javax.management.AttributeChangeNotification) Notification(javax.management.Notification) RelationNotification(javax.management.relation.RelationNotification)

Example 73 with Notification

use of javax.management.Notification in project camel by apache.

the class JMXNotificationTraceEventHandler method traceExchange.

public void traceExchange(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
    if (notificationSender != null && tracer.isJmxTraceNotifications()) {
        String body = MessageHelper.extractBodyForLogging(exchange.getIn(), "", false, true, tracer.getTraceBodySize());
        if (body == null) {
            body = "";
        }
        String message = body.substring(0, Math.min(body.length(), MAX_MESSAGE_LENGTH));
        Map<String, Object> tm = createTraceMessage(node, exchange, body);
        Notification notification = new Notification("TraceNotification", exchange.toString(), num.getAndIncrement(), System.currentTimeMillis(), message);
        notification.setUserData(tm);
        notificationSender.sendNotification(notification);
    }
}
Also used : Notification(javax.management.Notification)

Example 74 with Notification

use of javax.management.Notification in project quasar by puniverse.

the class MonitoringServices method addPerfNotificationListener.

public synchronized void addPerfNotificationListener(NotificationListener listener, Object handback) {
    timer.addNotificationListener(listener, new NotificationFilter() {

        @Override
        public boolean isNotificationEnabled(Notification notification) {
            return "perfTimer".equals(notification.getType());
        }
    }, handback);
    perfTimerListeners++;
    manageTimer();
}
Also used : NotificationFilter(javax.management.NotificationFilter) Notification(javax.management.Notification)

Example 75 with Notification

use of javax.management.Notification in project quasar by puniverse.

the class MonitoringServices method addStructuralNotificationListener.

public synchronized void addStructuralNotificationListener(NotificationListener listener, Object handback) {
    timer.addNotificationListener(listener, new NotificationFilter() {

        @Override
        public boolean isNotificationEnabled(Notification notification) {
            return "structTimer".equals(notification.getType());
        }
    }, handback);
    structuralTimerListeners++;
    manageTimer();
}
Also used : NotificationFilter(javax.management.NotificationFilter) Notification(javax.management.Notification)

Aggregations

Notification (javax.management.Notification)134 ObjectName (javax.management.ObjectName)47 NotificationListener (javax.management.NotificationListener)30 AttributeChangeNotification (javax.management.AttributeChangeNotification)22 HashMap (java.util.HashMap)16 MBeanServer (javax.management.MBeanServer)15 JMXConnector (javax.management.remote.JMXConnector)14 JMXServiceURL (javax.management.remote.JMXServiceURL)14 NotificationFilter (javax.management.NotificationFilter)13 MBeanServerConnection (javax.management.MBeanServerConnection)12 JMXConnectorServer (javax.management.remote.JMXConnectorServer)11 Test (org.junit.Test)11 IOException (java.io.IOException)10 MBeanServerNotification (javax.management.MBeanServerNotification)9 ArrayList (java.util.ArrayList)8 Attribute (javax.management.Attribute)8 ListenerNotFoundException (javax.management.ListenerNotFoundException)7 CompositeData (javax.management.openmbean.CompositeData)7 JMXConnectionNotification (javax.management.remote.JMXConnectionNotification)7 MalformedURLException (java.net.MalformedURLException)6