Package javax.management

Examples of javax.management.NotificationEmitter.removeNotificationListener()


    void dispose()
    {
        NotificationEmitter memEmitter = (NotificationEmitter) getMemory();
        try
        {
            memEmitter.removeNotificationListener(this);
        }
        catch (ListenerNotFoundException e)
        {
            // don't care
        }
View Full Code Here


        if (removeAll)
            broadcaster.removeNotificationListener(listenerWrapper);
        else {
            NotificationEmitter emitter = (NotificationEmitter) broadcaster;
            emitter.removeNotificationListener(listenerWrapper,
                                               filter,
                                               handback);
        }
    }
View Full Code Here

      messages.clear();
      test.sendNotification();
      assertTrue(messages.size() == 1);

      proxy.removeNotificationListener(this);

      messages.clear();
      test.sendNotification();
      assertTrue(messages.size() == 0);
   }
View Full Code Here

      messages.clear();
      test.sendNotification();
      assertTrue(messages.size() == 1);

      proxy.removeNotificationListener(this, filter, handback);

      messages.clear();
      test.sendNotification();
      assertTrue(messages.size() == 0);
   }
View Full Code Here

      test.sendNotification();
      assertTrue(messages.size() == 1);

      try
      {
         proxy.removeNotificationListener(this, filter, handback);
         fail("FAILS IN JBOSSMX: removeNotificationListener(NotificationListener, NotificationFilter, Object) " +
              "should not work for a broadcaster");
      }
      catch (Exception ignored)
      {
View Full Code Here

                    (AttributeChangeNotification)notification;
            assertEquals("State",acn.getAttributeName());
            assertEquals(ScanState.class.getName(),acn.getAttributeType());
            assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
            assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
            emitter.removeNotificationListener(listener,filter,handback);
        } finally {
            try {
                op.cancel();
            } catch (Exception x) {
                System.err.println("Failed to cleanup: "+x);
View Full Code Here

                    (AttributeChangeNotification)notification;
            assertEquals("State",acn.getAttributeName());
            assertEquals(ScanState.class.getName(),acn.getAttributeType());
            assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
            assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
            emitter.removeNotificationListener(listener,filter,handback);
        } finally {
            try {
                op.cancel();
            } catch (Exception x) {
                System.err.println("Failed to cleanup: "+x);
View Full Code Here

    memoryMXBean = ManagementFactory.getMemoryMXBean();
    NotificationEmitter emitter = (NotificationEmitter)memoryMXBean;
    List<MemoryPoolMXBean> memPools = ManagementFactory.getMemoryPoolMXBeans();
    for (MemoryPoolMXBean memoryPoolMXBean : memPools) {
      try {
        emitter.removeNotificationListener(this, null, memoryPoolMXBean);
      } catch (Exception e) {  }
      MemoryUsage memUsage = memoryPoolMXBean.getUsage();
      if (memUsage != null) {
        if (memoryPoolMXBean.isUsageThresholdSupported()) {
          emitter.addNotificationListener(this, null, memoryPoolMXBean);
View Full Code Here

      server.registerMBean(mbean, name);

      NotificationEmitter proxy = (NotificationEmitter)MBeanServerInvocationHandler.newProxyInstance(server, name, NotificationEmitter.class, true);
      TestListener listener = new TestListener();
      proxy.addNotificationListener(listener, null, null);
      proxy.removeNotificationListener(listener);
      mbean.test();
      if (listener.received) fail();
   }

   public void testRemoveNotificationListener() throws Exception
View Full Code Here

      NotificationEmitter proxy = (NotificationEmitter)MBeanServerInvocationHandler.newProxyInstance(server, name, NotificationEmitter.class, true);
      TestListener listener = new TestListener();
      TestFilter filter = new TestFilter();
      Object handback = new Object();
      proxy.addNotificationListener(listener, filter, handback);
      proxy.removeNotificationListener(listener, filter, handback);
      mbean.test();
      if (listener.received) fail();
   }

   public void testRemoveMultiNotificationListener() 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.