Package javax.management

Examples of javax.management.MBeanServerConnection.addNotificationListener()


         sleep(5000);

         cntor = JMXConnectorFactory.connect(cntorServer.getAddress(), getEnvironment());
         MBeanServerConnection mbsc1 = cntor.getMBeanServerConnection();

         mbsc1.addNotificationListener(emitterName, listener, null, null);
         // Wait for notification threads to start
         sleep(1000);

         Notification notification = new Notification("type", emitter, 0);
         emitter.emit(notification);
View Full Code Here


      JMXConnector cntor = JMXConnectorFactory.connect(new JMXServiceURL(url));
      MBeanServerConnection cntion = cntor.getMBeanServerConnection();

      InteroperabilityListener listener = new InteroperabilityListener();
      ObjectName delegateName = ObjectName.getInstance("JMImplementation:type=MBeanServerDelegate");
      cntion.addNotificationListener(delegateName, listener, null, null);
      sleep(1000);

      ObjectName name = ObjectName.getInstance(":mbean=mlet");
      cntion.createMBean(MLet.class.getName(), name, null);
      sleep(1000);
View Full Code Here

            {
            }
         };

         // Add the listener and be sure the mechanism of removal works fine
         mbsc.addNotificationListener(emitterName, listener, null, null);
         assertEquals(emitter.getSize(), 1);
         mbsc.removeNotificationListener(emitterName, listener, null, null);
         assertEquals(emitter.getSize(), 0);

         // Add the listener and close the connector
View Full Code Here

         assertEquals(emitter.getSize(), 1);
         mbsc.removeNotificationListener(emitterName, listener, null, null);
         assertEquals(emitter.getSize(), 0);

         // Add the listener and close the connector
         mbsc.addNotificationListener(emitterName, listener, null, null);
         assertEquals(emitter.getSize(), 1);
         cntor.close();
         assertEquals(emitter.getSize(), 0);
      }
      finally
View Full Code Here

       
        if (mbsc == null)
        {
            throw new ManagementConsoleException("Server connection is broken");
        }
        mbsc.addNotificationListener(jmxbean.getObjectName(), serverRegistry.getNotificationListener(), null, null);
    }
   
    public static void removeNotificationListener(ManagedBean mbean, String name, String type) throws Exception
    {
        JMXServerRegistry serverRegistry = (JMXServerRegistry)ApplicationRegistry.getServerRegistry(mbean);
View Full Code Here

       
        if (mbsc == null)
        {
            throw new ManagementConsoleException("Server connection is broken");
        }
        mbsc.addNotificationListener(jmxbean.getObjectName(), serverRegistry.getNotificationListener(), null, null);
    }
   
    public static void removeNotificationListener(ManagedBean mbean, String name, String type) throws Exception
    {
        JMXServerRegistry serverRegistry = (JMXServerRegistry)ApplicationRegistry.getServerRegistry(mbean);
View Full Code Here

        // Setup the monitor: register a listener
        MBeanServerConnection connection = connector.getMBeanServerConnection();
        final AtomicBoolean notificationSet = new AtomicBoolean(false);
        //Add a notification listener to the connection - to
        //test for notifications across camel
        connection.addNotificationListener(monitorName, new NotificationListener() {
            public void handleNotification(Notification notification, Object handback) {
                System.out.println("Notification = " + notification);
                synchronized (notificationSet) {
                    notificationSet.set(true);
                    notificationSet.notify();
View Full Code Here

       
        if (mbsc == null)
        {
            throw new ManagementConsoleException("Server connection is broken");
        }
        mbsc.addNotificationListener(jmxbean.getObjectName(), serverRegistry.getNotificationListener(), null, null);
    }
   
    public static void removeNotificationListener(ManagedBean mbean, String name, String type) throws Exception
    {
        JMXServerRegistry serverRegistry = (JMXServerRegistry)ApplicationRegistry.getServerRegistry(mbean);
View Full Code Here

          return null;
        }
       
        final Set<ObjectName> queryNames = connection.queryNames(bundleStateQueryObjectName, null);
        for (ObjectName bundleStateObjectName : queryNames) {
          connection.addNotificationListener(bundleStateObjectName, listener, filter, handback);
          return null;
        }
        return null;
      }
    });
View Full Code Here

       
        // subscribe for a notifications
        TaskStateFilter filter = new TaskStateFilter();
        TestListener listener = new TestListener(filter);           
        MBeanServerConnection mbServerConn = this.jmxConnector.getMBeanServerConnection();
        mbServerConn.addNotificationListener(taskThread, listener, null, null);
       
        Notification notification = null;
       
        // check for task hung notification
        notification = listener.getNotification(TIMEOUT);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.