Package javax.management.remote

Examples of javax.management.remote.TargetedNotification


        final int size = infoList.size();
        listeners  = new HashMap(((size>len)?len:size));

        for (int i = 0 ; i < len ; i++) {
      final TargetedNotification tn = notifs[i];
      final Integer listenerID = tn.getListenerID();
     
      // check if an mbean unregistration notif
      if (!listenerID.equals(mbeanRemovedNotifID)) {
          final ListenerInfo li =
        (ListenerInfo) infoList.get(listenerID);
          if (li != null)
        listeners.put(listenerID,li);
          continue;
      }
      final Notification notif = tn.getNotification();
      final String unreg =
          MBeanServerNotification.UNREGISTRATION_NOTIFICATION;
      if (notif instanceof MBeanServerNotification &&
          notif.getType().equals(unreg)) {
         
          MBeanServerNotification mbsn =
        (MBeanServerNotification) notif;
          ObjectName name = mbsn.getMBeanName();
         
          removeNotificationListener(name);
      }
        }
        myListenerID = mbeanRemovedNotifID;
    }

    if (missed > 0) {
        final String msg =
      "May have lost up to " + missed +
      " notification" + (missed == 1 ? "" : "s");
        lostNotifs(msg, missed);
        logger.trace("NotifFetcher.run", msg);
    }

    // forward
    for (int i = 0 ; i < len ; i++) {
        final TargetedNotification tn = notifs[i];
        dispatchNotification(tn,myListenerID,listeners);
    }
      }

      // tell that the thread is REALLY stopped
View Full Code Here


     single TN, because an arbitrary serializer might not know
     how to serialize a single TN (for example, it's an XML
     serializer that can serialize an NR containing a TN but not
     a TN on its own).  */
  for (int i = 0; i < tns.length; i++) {
      TargetedNotification tn = tns[i];
      NotificationResult trialnr =
    new NotificationResult(0, 0, new TargetedNotification[] {tn});
      try {
    serialization.wrap(trialnr);
    tnList.add(tn);
      } catch (IOException e) {
    logger.warning("purgeUnserializable",
             "cannot serialize notif: " + tn);
    logger.fine("purgeUnserializable", e);
    final Integer listenerID = tn.getListenerID();
    final Notification badNotif = tn.getNotification();
    final String notifType = JMXConnectionNotification.NOTIFS_LOST;
    final String notifMessage = "Not serializable: " + badNotif;
    Notification goodNotif =
        new JMXConnectionNotification(notifType,
              badNotif.getSource(),
              clientId,
              badNotif.getSequenceNumber(),
              notifMessage,
              ONE_LONG);
    /* Our implementation has the convention that a NOTIFS_LOST
       has a userData that says how many notifs were lost.  */
    tn = new TargetedNotification(goodNotif, listenerID);
    trialnr =
        new NotificationResult(0, 0,
             new TargetedNotification[] {tn});
    try {
        serialization.wrap(trialnr);
View Full Code Here

        tns = nr.getTargetedNotifications();
        if (tns.length != 1) {
            System.out.println("Expected 1 notif, got: " + Arrays.asList(tns));
            return false;
        }
        TargetedNotification tn1 = tns[0];
        System.out.println("Got 1 notif when asked for 1, OK");

        // Now we should get the other one
        nr = nb.fetchNotifications(allListenerFilter, nr.getNextSequenceNumber(),
                                   0L, 1);
        tns = nr.getTargetedNotifications();
        if (tns.length != 1) {
            System.out.println("Expected 1 notif, got: " + Arrays.asList(tns));
            return false;
        }
        TargetedNotification tn2 = tns[0];
        System.out.println("Got 1 notif when asked for 1 again, OK");

        if (tn1.getNotification() == tn2.getNotification()) {
            System.out.println("Returned same notif twice: " + tn1);
            return false;
        }
        System.out.println("2 creation notifs are different, OK");
View Full Code Here

        if (tn1.length != tn2.length) {
            System.out.println("Not same length");
            return false;
        }
        for (int i = 0; i < tn1.length; i++) {
            TargetedNotification n1 = tn1[i];
            TargetedNotification n2 = tn2[i];
            if (n1.getNotification() != n2.getNotification()
                || !n1.getListenerID().equals(n2.getListenerID()))
                return false;
        }
        return true;
    }
View Full Code Here

        return new NotificationBufferFilter() {
            public void apply(List<TargetedNotification> notifs,
                              ObjectName source, Notification notif) {
                if (pattern.apply(source)) {
                    if (filter == null || filter.isNotificationEnabled(notif))
                        notifs.add(new TargetedNotification(notif, id));
                }
            }
        };
    };
View Full Code Here

TOP

Related Classes of javax.management.remote.TargetedNotification

Copyright © 2018 www.massapicom. 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.