Package javax.management

Examples of javax.management.NotificationEmitter.addNotificationListener()


      NotificationEmitter proxy = (NotificationEmitter)MBeanServerInvocationHandler.newProxyInstance(server, name, NotificationEmitter.class, true);
      TestListener listener1 = new TestListener();
      TestFilter filter = new TestFilter();
      Object handback = new Object();
      proxy.addNotificationListener(listener1, filter, handback);

      TestListener listener2 = new TestListener();
      proxy.addNotificationListener(listener2, null, null);

      mbean.test();
View Full Code Here


      TestFilter filter = new TestFilter();
      Object handback = new Object();
      proxy.addNotificationListener(listener1, filter, handback);

      TestListener listener2 = new TestListener();
      proxy.addNotificationListener(listener2, null, null);

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

              _gc_callback -= (_gc_callback>>3);
            }
          }
          NotificationEmitter emitter = (NotificationEmitter) _allMemBean;
          emitter.addNotificationListener(this, null, m);
          ++c;
        }
      }
      assert c == 1;
    }
View Full Code Here

        NotificationFilter filter = null;
        Object handback = null;
        final ScanState before;
        final NotificationEmitter emitter = (NotificationEmitter)
                makeNotificationEmitter(proxy,DirectoryScannerMXBean.class);
        emitter.addNotificationListener(listener, filter, handback);
        before = proxy.getState();
        op.call();
        try {
            final Notification notification =
                    queue.poll(3000,TimeUnit.MILLISECONDS);
View Full Code Here

        };
        NotificationFilter filter = null;
        Object handback = null;
        final ScanState before;
        final NotificationEmitter emitter = (NotificationEmitter)proxy;
        emitter.addNotificationListener(listener, filter, handback);
        before = proxy.getState();
        op.call();
        try {
            final Notification notification =
                    queue.poll(3000,TimeUnit.MILLISECONDS);
View Full Code Here

          // just FYI
          // System.out.println("memory threshold exceeded !!! : \n "+memString());
        }
      }
    };
    emitter.addNotificationListener(l,null,null);
   
    // remove previous listeners
    for(NotificationListener n : listeners){
      try {
        emitter.removeNotificationListener(n);
View Full Code Here

          // just FYI
          // System.out.println("memory threshold exceeded !!! : \n "+memString());
        }
      }
    };
    emitter.addNotificationListener(l,null,null);
   
    // remove previous listeners
    for(NotificationListener n : listeners){
      try {
        emitter.removeNotificationListener(n);
View Full Code Here

  }

  private MemoryMonitor() {
    final MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
    NotificationEmitter emitter = (NotificationEmitter) mbean;
    emitter.addNotificationListener(new NotificationListener() {
      public void handleNotification(Notification n, Object hb) {
        if (n.getType()
            .equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
          long maxMemory = tenuredGenPool.getUsage().getMax();
          long usedMemory = tenuredGenPool.getUsage().getUsed();
View Full Code Here

       
        // Test notifications
        NotificationEmitter notifyProxy = (NotificationEmitter) proxy;
        TestJMXNotificationListener listener =
                new TestJMXNotificationListener();
        notifyProxy.addNotificationListener(listener, null, null);
        // add another node
        SgsTestNode node3 = null;
        try {
            node3 = new SgsTestNode(serverNode, null, null);
            // We expect to see one notification for a started node
View Full Code Here

        }
       
        MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
        NotificationEmitter emitter = (NotificationEmitter) mbean;
        MemoryNotificationListener listener = new MemoryNotificationListener(types);
        emitter.addNotificationListener(listener, null, cs);
        init=true;
  }
}
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.