Package javax.management.remote

Examples of javax.management.remote.TargetedNotification


                    final int size = infoList.size();
                    listeners = new HashMap<Integer, ClientListenerInfo>();

                    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 ClientListenerInfo li = 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);
                }
            }

            synchronized (ClientNotifForwarder.this) {
View Full Code Here


      else if (TargetedNotificationSer.LISTENER_ID.equals(hint)) listenerID = (Integer)value;
   }

   protected Object createObject() throws SAXException
   {
      return new TargetedNotification(notification, listenerID);
   }
View Full Code Here

   private static final QName LISTENER_ID_QNAME = new QName("", LISTENER_ID);
   static final String TYPE = "TargetedNotification";

   public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException
   {
      TargetedNotification targetedNotification = (TargetedNotification)value;
      context.startElement(name, attributes);
      context.serialize(NOTIFICATION_QNAME, null, targetedNotification.getNotification());
      context.serialize(LISTENER_ID_QNAME, null, targetedNotification.getListenerID());
      context.endElement();
   }
View Full Code Here

            if (doNotify)
            {
               // Avoid spin looping the fetcher thread, but don't sleep too much, we have to fill the client's queue
               sleep(sleep);
               TargetedNotification[] notifications = new TargetedNotification[count];
               for (int i = 0; i < count; ++i) notifications[i] = new TargetedNotification(new Notification("type", name, sequenceNumber + i), id);
               long nextSequence = sequenceNumber + count;
               NotificationResult result = new NotificationResult(0, nextSequence, notifications);
               synchronized (lock)
               {
                  queued.set(getNotificationsCount());
View Full Code Here

   {
      Logger logger = null;
      ArrayList list = new ArrayList();
      for (int i = 0; i < notifications.length; ++i)
      {
         TargetedNotification notification = notifications[i];
         if (MX4JRemoteUtils.isTrulySerializable(notification))
         {
            list.add(notification);
         }
         else
View Full Code Here

      return sdp;
   }

   public TargetedNotification createTargetedNotification()
   {
      TargetedNotification tn = new TargetedNotification(createJMXConnectionNotification(), Integer.decode("1"));
      return tn;
   }
View Full Code Here

      if (!valid) throw new RuntimeException();
   }

   public void compareTargetedNotification(Object obj1, Object obj2)
   {
      TargetedNotification tn1 = (TargetedNotification)obj1;
      TargetedNotification tn2 = (TargetedNotification)obj2;
      boolean valid = tn1.getListenerID().equals(tn2.getListenerID());
      compareNotifications(tn1.getNotification(), tn2.getNotification());

      if (!valid) throw new RuntimeException();
   }
View Full Code Here

                    clientSequenceNumber = nr.getNextSequenceNumber();

                    listeners = new HashMap<Integer, ClientListenerInfo>();

                    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 ClientListenerInfo li = 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);
                }
            }

            synchronized (ClientNotifForwarder.this) {
View Full Code Here

                    final int size = infoList.size();
                    listeners = new HashMap<Integer, ClientListenerInfo>();

                    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 ClientListenerInfo li = 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);
                }
            }

            synchronized (ClientNotifForwarder.this) {
View Full Code Here

                        if (filter == null
                            || filter.isNotificationEnabled(notif)) {
                            logger.debug("fetchNotifications",
           "filter matches");
                            Integer listenerID = li.getListenerID();
                            TargetedNotification tn =
                                new TargetedNotification(notif, listenerID);
                            matchedNotifs.add(tn);
                        }
                    }
                }
            }
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.