Package javax.management

Examples of javax.management.NotificationListener


                logger.trace("NotifFetcher.dispatch",
                             "Listener ID not in map");
                return;
            }

            NotificationListener l = li.getListener();
            Object h = li.getHandback();
            try {
                l.handleNotification(notif, h);
            } catch (RuntimeException e) {
                final String msg =
                    "Failed to forward a notification " +
                    "to a listener";
                logger.trace("NotifFetcher-run", msg, e);
View Full Code Here


        if (listener == null) {
            throw new RuntimeOperationsException(new
                IllegalArgumentException("Null listener"),"Null listener");
        }

        NotificationListener listenerWrapper =
            getListenerWrapper(listener, name, instance, true);
        broadcaster.addNotificationListener(listenerWrapper, filter, handback);
    }
View Full Code Here

    }

    public void removeNotificationListener(ObjectName name,
                                           ObjectName listener)
            throws InstanceNotFoundException, ListenerNotFoundException {
        NotificationListener instance = getListener(listener);

        if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
            MBEANSERVER_LOGGER.logp(Level.FINER,
                    DefaultMBeanServerInterceptor.class.getName(),
                    "removeNotificationListener",
View Full Code Here

                                           ObjectName listener,
                                           NotificationFilter filter,
                                           Object handback)
            throws InstanceNotFoundException, ListenerNotFoundException {

        NotificationListener instance = getListener(listener);

        if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
            MBEANSERVER_LOGGER.logp(Level.FINER,
                    DefaultMBeanServerInterceptor.class.getName(),
                    "removeNotificationListener",
View Full Code Here

        Class<? extends NotificationBroadcaster> reqClass =
            removeAll ? NotificationBroadcaster.class : NotificationEmitter.class;
        NotificationBroadcaster broadcaster =
            getNotificationBroadcaster(name, instance, reqClass);

        NotificationListener listenerWrapper =
            getListenerWrapper(listener, name, instance, false);

        if (listenerWrapper == null)
            throw new ListenerNotFoundException("Unknown listener");
View Full Code Here

        Object resource = getResource(mbean);
        ListenerWrapper wrapper = new ListenerWrapper(l, name, resource);
        synchronized (listenerWrappers) {
            WeakReference<ListenerWrapper> ref = listenerWrappers.get(wrapper);
            if (ref != null) {
                NotificationListener existing = ref.get();
                if (existing != null)
                    return existing;
            }
            if (create) {
                ref = new WeakReference<ListenerWrapper>(wrapper);
View Full Code Here

        // loop on listener
        //
        for(java.util.Enumeration<NotificationListener> k = handbackTable.keys();
            k.hasMoreElements(); ) {

            NotificationListener listener = k.nextElement();

            // Get the associated handback list and the associated filter list
            //
            java.util.Vector<?> handbackList = handbackTable.get(listener) ;
            java.util.Vector<NotificationFilter> filterList =
                filterTable.get(listener) ;

            // loop on handback
            //
            java.util.Enumeration<NotificationFilter> f = filterList.elements();
            for(java.util.Enumeration<?> h = handbackList.elements();
                h.hasMoreElements(); ) {

                Object handback = h.nextElement();
                NotificationFilter filter = f.nextElement();

                if ((filter == null) ||
                     (filter.isNotificationEnabled(notification))) {

                    listener.handleNotification(notification,handback) ;
                }
            }
        }
    }
View Full Code Here

      ObjectName objName = new ObjectName("test:name=sample");
      connection.createMBean(Sample.class.getName(), objName);
      Object ret = connection.invoke(objName, "doSomething", new Object[] {"foo"}, new String[] {String.class.getName()});
      System.out.println("Return to doSomething() is " + ret);

      NotificationListener listener = new Listener();
      connection.addNotificationListener(objName,listener, null, null);

      ret = connection.invoke(objName, "doSomething", new Object[] {"bar"}, new String[] {String.class.getName()});
      System.out.println("Return to doSomething() is " + ret);
View Full Code Here

                  deliverNotification = false;
               }
            }
            if(deliverNotification)
            {
               final NotificationListener listener = holder.getListener();
               final Object handback = holder.getHandback();
               Runnable notifyRun = new Runnable()
               {
                  public void run()
                  {
                     try
                     {
                        listener.handleNotification(notification, handback);
                     }
                     catch(Throwable e)
                     {
                        log.error("Error delivering notification to listener: " + listener, e);
                     }
View Full Code Here

        // loop on listener
        //
        for(java.util.Enumeration k = handbackTable.keys();
      k.hasMoreElements(); ) {
           
            NotificationListener listener =
    (NotificationListener) k.nextElement();

            // Get the associated handback list and the associated filter list
            //
            java.util.Vector handbackList =
    (java.util.Vector) handbackTable.get(listener) ;
            java.util.Vector filterList =
    (java.util.Vector) filterTable.get(listener) ;

            // loop on handback
            //
            java.util.Enumeration f = filterList.elements();
            for(java.util.Enumeration h = handbackList.elements();
    h.hasMoreElements(); ) {
               
                Object handback = h.nextElement();
                NotificationFilter filter =
        (NotificationFilter)f.nextElement();

                if ((filter == null) ||
                    ((filter != null) &&
         (filter.isNotificationEnabled(notification)))) {
       
                    listener.handleNotification(notification,handback) ;
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.management.NotificationListener

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.