Package javax.management.remote

Examples of javax.management.remote.TargetedNotification


   protected TargetedNotification[] filterNotifications(TargetedNotification[] notifications)
   {
      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


      {
         while (isActive() && !thread.isInterrupted())
         {
            try
            {
               TargetedNotification notification = null;
               synchronized (notificationQueue)
               {
                  while (notificationQueue.isEmpty()) notificationQueue.wait();
                  notification = (TargetedNotification)notificationQueue.remove(0);
               }
View Full Code Here

      return notifications;
   }

   private void addNotification(Integer id, Notification notification)
   {
      buffer.add(new TargetedNotification(notification, id));
   }
View Full Code Here

public class TargetedNotificationTest
  implements Testlet
{
  public void test(TestHarness h)
  {
    TargetedNotification tn;
    Notification n = new Notification("", this, 1);
    h.checkPoint("Constructor tests");
    try
      {
  tn = new TargetedNotification(null, 3);
  h.fail("Failed to catch null notification");
      }
    catch (Exception e)
      {
  if (e instanceof IllegalArgumentException)
    h.check(true, "Caught null notification.");
  else
    {
      h.debug(e);
      h.fail("Unknown exception");
    }
      }
    try
      {
  tn = new TargetedNotification(n, null);
  h.fail("Failed to catch null identifier");
      }
    catch (Exception e)
      {
  if (e instanceof IllegalArgumentException)
    h.check(true, "Caught null identifier.");
  else
    {
      h.debug(e);
      h.fail("Unknown exception");
    }
      }
    try
      {
  tn = new TargetedNotification(n, 3);
  h.check(true, "Successfully created notification");
  h.check(n == tn.getNotification(), "Check notification retrieval");
  h.check(3 == tn.getListenerID(), "Check ID retrieval");
      }
    catch (Exception e)
      {
  if (e instanceof IllegalArgumentException)
    {
View Full Code Here

         {
            while (isActive() && !thread.isInterrupted())
            {
               try
               {
                  TargetedNotification notification = null;
                  synchronized (this)
                  {
                     while (notificationQueue.isEmpty()) wait();
                     notification = (TargetedNotification)notificationQueue.remove(0);
                  }
View Full Code Here

      return notifications;
   }

   private void addNotification(Integer id, Notification notification)
   {
      buffer.add(new TargetedNotification(notification, id));
   }
View Full Code Here

            // variable of our caller and no other thread can see it.
            for (IdAndFilter idaf : candidates) {
                final NotificationFilter nf = idaf.getFilter();
                if (nf == null || nf.isNotificationEnabled(notif)) {
                    logger.debug("bufferFilter", "filter matches");
                    final TargetedNotification tn =
                            new TargetedNotification(notif, idaf.getId());
                    if (allowNotificationEmission(source, tn))
                        targetedNotifs.add(tn);
                }
            }
        }
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

   private void deliverNotifications(TargetedNotification[] targetedNotifications)
   {
      for(int x = 0; x < targetedNotifications.length; x++)
      {
         TargetedNotification targetedNotification = targetedNotifications[x];
         Integer id = targetedNotification.getListenerID();
         ClientListenerHolder holder = (ClientListenerHolder)clientListeners.get(id);
         if(holder != null)
         {
            final Notification notification = targetedNotification.getNotification();
            boolean deliverNotification = true;
            if(holder.getFilterOnClient())
            {
               NotificationFilter filter = holder.getFilter();
               if(!filter.isNotificationEnabled(notification))
View Full Code Here

         if(clientListenerNotifications.size() == maxNumberOfNotifications)
         {
            clientListenerNotifications.remove(0);
            startSequence++;
         }
         TargetedNotification targetedNotification = new TargetedNotification(notification, id);
         clientListenerNotifications.add(targetedNotification);
         currentSequence++;
      }
   }
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.