Package javax.management

Examples of javax.management.NotificationListener


    public ScanDirAgent() {
        // Initialize the notification queue
        queue = new LinkedBlockingQueue<Notification>();

        // Creates the listener.
        listener = new NotificationListener() {
            public void handleNotification(Notification notification,
                                           Object handback) {
                try {
                    // Just put the received notification in the queue.
                    // It will be consumed later on by 'waitForClose()'
View Full Code Here


        System.out.println("doTestOperation: "+testName);
       
        final LinkedBlockingQueue<Notification> queue =
                new LinkedBlockingQueue<Notification>();
       
        NotificationListener listener = new NotificationListener() {
            public void handleNotification(Notification notification,
                        Object handback) {
                try {
                    queue.put(notification);
                } catch (Exception x) {
View Full Code Here

        System.out.println("doTestOperation: "+testName);
       
        final LinkedBlockingQueue<Notification> queue =
                new LinkedBlockingQueue<Notification>();
       
        NotificationListener listener = new NotificationListener() {
            public void handleNotification(Notification notification,
                        Object handback) {
                try {
                    queue.put(notification);
                } catch (Exception x) {
View Full Code Here

                    manager.getDirectoryScanners().get("test1");
            final Call op = new Call() {
                public void call() throws Exception {
                    final BlockingQueue<Notification> queue =
                            new LinkedBlockingQueue<Notification>();
                    final NotificationListener listener = new NotificationListener() {
                        public void handleNotification(Notification notification,
                                Object handback) {
                            try {
                               queue.put(notification);
                            } catch (Exception e) {
View Full Code Here

                logger.trace("NotifFetcher.dispatch",
                        "Listener ID not in map");
                return;
            }

            NotificationListener l = li.getListener();
            Object h = li.getHandback();
            try {
                l.handleNotification(notif, h);
            } catch (RuntimeException e) {
                final String msg =
                        "Failed to forward a notification " +
                        "to a listener";
                logger.trace("NotifFetcher-run", msg, e);
View Full Code Here

    MetricName gcTimesName = new MetricName(ORG_APACHE_BLUR, JVM, GC_TIMES);
    _gcTimes = Metrics.newTimer(gcTimesName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);

    List<GarbageCollectorMXBean> garbageCollectorMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
    for (GarbageCollectorMXBean bean : garbageCollectorMXBeans) {
      NotificationListener listener = new NotificationListener() {
        @Override
        public void handleNotification(Notification notification, Object bean) {
          GarbageCollectorMXBean garbageCollectorMXBean = (GarbageCollectorMXBean) bean;
          GcInfo gcInfo = getGcInfo(garbageCollectorMXBean);
          long startTime = gcInfo.getStartTime();
View Full Code Here

       
        // notifications
       
        final List<Notification> received = new ArrayList<Notification>();
     
        mbeanServer.addNotificationListener(new ObjectName(BundleStateMBean.OBJECTNAME), new NotificationListener() {
            public void handleNotification(Notification notification, Object handback) {
               received.add(notification);
            }
        }, null, null);
       
View Full Code Here

       
        // notifications
       
        final List<Notification> received = new ArrayList<Notification>();
     
        mbeanServer.addNotificationListener(new ObjectName(ServiceStateMBean.OBJECTNAME), new NotificationListener() {
            public void handleNotification(Notification notification, Object handback) {
               received.add(notification);
            }
        }, null, null);
       
View Full Code Here

  private void replaceNotificationListenerBeanNameMappingKeysIfNecessary(String beanName, ObjectName objectName) {
    Set mappedListeners = new HashSet();
    String objectNameString = objectName.getCanonicalName();
    for (int i = 0; i < notificationListeners.length; i++) {
      NotificationListenerBean bean = notificationListeners[i];
      NotificationListener listener = bean.getNotificationListener();
      Set newMappedNames = new HashSet();
      String[] mappedNames = bean.getMappedObjectNames();
      for (int j = 0; j < mappedNames.length; j++) {
        String mappedName = mappedNames[j];
        if (mappedName.equals(beanName)) {
View Full Code Here

   * with the {@link MBeanServer}.
   */
  private void registerNotificationListeners() throws MBeanExportException {
    for (int i = 0; i < this.notificationListeners.length; i++) {
      NotificationListenerBean bean = this.notificationListeners[i];
      NotificationListener listener = bean.getNotificationListener();
      NotificationFilter filter = bean.getNotificationFilter();
      Object handback = bean.getHandback();
      ObjectName[] namesToRegisterWith = getObjectNamesForNotificationListener(bean);
      for (int j = 0; j < namesToRegisterWith.length; j++) {
        ObjectName objectName = namesToRegisterWith[j];
View Full Code Here

TOP

Related Classes of javax.management.NotificationListener

Copyright © 2018 www.massapicom. 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.