Package javax.management

Examples of javax.management.NotificationListener


        NotificationEmitter emitter = (NotificationEmitter) mbean;

       
        emitter.addNotificationListener(
          new NotificationListener()
          {
            private long  last_mb_log = Long.MAX_VALUE;
           
            private boolean increase_tried;
           
View Full Code Here


    OMemoryWatchDog.setPercentageUsageThreshold(iThreshold);

    final MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();

    final NotificationEmitter memEmitter = (NotificationEmitter) memBean;
    memEmitter.addNotificationListener(new NotificationListener() {
      public synchronized void handleNotification(Notification n, Object hb) {
        if (n.getType().equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
          alertTimes++;
          long maxMemory = tenuredGenPool.getUsage().getMax();
          long usedMemory = tenuredGenPool.getUsage().getUsed();
View Full Code Here

    /**********  Notifications **********/

    public void testNotificationListenerCalled() throws Exception
    {
        NotificationListener listener = mock(NotificationListener.class);
        _queueMBean.addNotificationListener(listener, null, null);

        NotificationCheck notification = mock(NotificationCheck.class);
        String notificationMsg = "Test notification message";

View Full Code Here

                                            isNull());
    }

    public void testAddRemoveNotificationListener() throws Exception
    {
        NotificationListener listener1 = mock(NotificationListener.class);
        _queueMBean.addNotificationListener(listener1, null, null);
        _queueMBean.removeNotificationListener(listener1);
    }
View Full Code Here

        _queueMBean.removeNotificationListener(listener1);
    }

    public void testRemoveUnknownNotificationListener() throws Exception
    {
        NotificationListener listener1 = mock(NotificationListener.class);
        try
        {
            _queueMBean.removeNotificationListener(listener1);
            fail("Exception not thrown");
        }
View Full Code Here

            // if we are not already an ObjectName (compliant with RI behaviour)
            notification.setSource(objectName);
         }

         // Notify the real listener
         NotificationListener listener = getTargetListener();
         listener.handleNotification(notification, handback);
      }
View Full Code Here

      {
         ObjectName name = names[i];
         MarshalledObject filter = filters[i];
         NotificationFilter f = (NotificationFilter)RMIMarshaller.unmarshal(filter, server.getClassLoaderFor(name), defaultLoader);
         Integer id = notificationHandler.generateListenerID(name, f);
         NotificationListener listener = notificationHandler.getServerNotificationListener();
         server.addNotificationListener(name, listener, f, id);
         notificationHandler.addNotificationListener(id, new NotificationTuple(name, listener, f, id));
         ids.add(id);
      }
      return (Integer[])ids.toArray(new Integer[ids.size()]);
View Full Code Here

         }
      }

      RmiConnectorActivator.log(LogService.LOG_DEBUG,"Sending Notification " + notif + ", listener info is " + tuple,null);

      NotificationListener listener = tuple.getNotificationListener();

      try
      {
         listener.handleNotification(notif, tuple.getHandback());
      }
      catch (RuntimeException x)
      {
         RmiConnectorActivator.log(LogService.LOG_WARNING,"RuntimeException caught from handleNotification, listener = " + listener, x);
         // And return quietly
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

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.