Package javax.management

Examples of javax.management.NotificationEmitter.removeNotificationListener()


      if (!listener1.received) fail();
      if (!listener2.received) fail();

      try
      {
         proxy.removeNotificationListener(listener2, filter, handback);
         fail("Listener is not registered");
      }
      catch (ListenerNotFoundException x)
      {
      }
View Full Code Here


      }
      catch (ListenerNotFoundException x)
      {
      }

      proxy.removeNotificationListener(listener2, null, null);
      listener1.received = false;
      listener2.received = false;

      mbean.test();
      if (!listener1.received) fail();
View Full Code Here

        if (removeAll)
            broadcaster.removeNotificationListener(listenerWrapper);
        else {
            NotificationEmitter emitter = (NotificationEmitter) broadcaster;
            emitter.removeNotificationListener(listenerWrapper,
                                               filter,
                                               handback);
        }
    }
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

    emitter.addNotificationListener(l,null,null);
   
    // remove previous listeners
    for(NotificationListener n : listeners){
      try {
        emitter.removeNotificationListener(n);
      } catch (ListenerNotFoundException e) {
        e.printStackTrace();
      }
    }
    listeners.clear();
View Full Code Here

    emitter.addNotificationListener(l,null,null);
   
    // remove previous listeners
    for(NotificationListener n : listeners){
      try {
        emitter.removeNotificationListener(n);
      } catch (ListenerNotFoundException e) {
        e.printStackTrace();
      }
    }
    listeners.clear();
View Full Code Here

            AtomicLong count = listener.notificationMap.get(
                                NodesMXBean.NODE_FAILED_NOTIFICATION);
            assertNotNull(count);
            assertEquals(1, count.longValue());
        }
        notifyProxy.removeNotificationListener(listener);
    }
   
    @Test
    public void testConfigMXBean() throws Exception {
        ObjectName name = new ObjectName(ConfigMXBean.MXBEAN_NAME);
View Full Code Here

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

    @Override public void shutdown() throws Exception {
        for (GarbageCollectorMXBean gcbean : ManagementFactory.getGarbageCollectorMXBeans()) {
            final NotificationEmitter emitter = (NotificationEmitter) gcbean;
            try {
                emitter.removeNotificationListener(listener, null, null);
            } catch (ListenerNotFoundException e) { // ignore this to facilitate repeated shutdown
            }
        }
    }
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.