Package javax.management

Examples of javax.management.MBeanServer.removeNotificationListener()


      );      
      server.addNotificationListener(
            new ObjectName("JMImplementation:type=MBeanServerDelegate"),
            listener2, null, "handback3"
      );      
      server.removeNotificationListener(
            new ObjectName("JMImplementation:type=MBeanServerDelegate"),
            listener2, null, "handback3"
      );      
   
      // force notification
View Full Code Here


            new ObjectName("JMImplementation:type=MBeanServerDelegate"),
            listener, null, null
      );

      // Remove ourselves from the broadcaster
      server.removeNotificationListener(broadcasterName, listener);      

      // Test we get a notification from the broadcaster
      broadcaster.doSomething();
      assertEquals(0, listener.result);
View Full Code Here

      ObjectName delegateName =
         new ObjectName("JMImplementation:type=MBeanServerDelegate");
      server.addNotificationListener(delegateName, listenerName1, null, "handback1");
      server.addNotificationListener(delegateName, listenerName2, null, "handback2");
      server.addNotificationListener(delegateName, listenerName2, null, "handback3");
      server.removeNotificationListener(delegateName, listenerName2);
   
      // force notification
      server.registerMBean(new Test(), new ObjectName(":foo=bar"));
      assertTrue("Listener1 should get a notification", listener1.count == 1);
      assertTrue("Source should be the delegate", listener1.source.equals(delegateName));
View Full Code Here

      ObjectName delegateName =
         new ObjectName("JMImplementation:type=MBeanServerDelegate");
      server.addNotificationListener(delegateName, listenerName1, null, "handback1");
      server.addNotificationListener(delegateName, listenerName2, null, "handback2");
      server.addNotificationListener(delegateName, listenerName2, null, "handback3");
      server.removeNotificationListener(delegateName, listenerName2, null, "handback3");
   
      // force notification
      server.registerMBean(new Test(), new ObjectName(":foo=bar"));
      assertTrue("Listener1 should get a notification", listener1.count == 1);
      assertTrue("Source should be the delegate", listener1.source.equals(delegateName));
View Full Code Here

      ObjectName broadcasterName = new ObjectName("test:type=Broadcaster");
      server.registerMBean(new Broadcaster(), broadcasterName);
     
      server.addNotificationListener(broadcasterName, listenerName, null, "handback1");
      server.removeNotificationListener(broadcasterName, listenerName, null, "handback1");
      server.unregisterMBean(broadcasterName);

      Broadcaster broadcaster = new Broadcaster();
      server.registerMBean(broadcaster, broadcasterName);
      server.addNotificationListener(broadcasterName, listenerName, null, "handback2");
View Full Code Here

      ObjectName delegateName =
         new ObjectName("JMImplementation:type=MBeanServerDelegate");
      server.addNotificationListener(delegateName,listenerName1, null, null);      

      // Remove ourselves from the broadcaster
      server.removeNotificationListener(broadcasterName, listener1);      

      // Test we get a notification from the broadcaster
      broadcaster.doSomething();
      assertEquals(0, listener1.count);
View Full Code Here

    final MBeanServer  server  = getMBeanServer();
    for( final ObjectName objectName : listenees )
    {
      try
      {
        server.removeNotificationListener( objectName, this );
        mListenees.remove( objectName );
      }
      catch( ListenerNotFoundException e )
      {
      }
View Full Code Here

      Notification notification = new Notification("type", emitter, 0);
      emitter.sendNotification(notification);
      assertEquals(objectName, source.get());

      server.removeNotificationListener(objectName, listener, null, null);
      assertEquals(emitter.getNotificationListeners().size(), 0);
   }

   public void testAddRemoveOneListenerTwiceOnOneMBean() throws Exception
   {
View Full Code Here

      Notification notification = new Notification("type", emitter, 0);
      emitter.sendNotification(notification);
      assertEquals(objectName, source.get());
      assertEquals(count.get(), 2);

      server.removeNotificationListener(objectName, listener, null, null);
      assertEquals(emitter.getNotificationListeners().size(), 1);

      server.removeNotificationListener(objectName, listener, null, handback);
      assertEquals(emitter.getNotificationListeners().size(), 0);
   }
View Full Code Here

      assertEquals(count.get(), 2);

      server.removeNotificationListener(objectName, listener, null, null);
      assertEquals(emitter.getNotificationListeners().size(), 1);

      server.removeNotificationListener(objectName, listener, null, handback);
      assertEquals(emitter.getNotificationListeners().size(), 0);
   }

   public void testAddRemoveTwoListenersOnOneMBean() throws Exception
   {
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.