Examples of NotificationListener


Examples of javax.management.NotificationListener

    {
        String methodName = method.getName();

        if (methodName.equals("addNotificationListener") && args != null)
        {
            NotificationListener notiListener = (NotificationListener) args[0];
            NotificationFilter filter = (NotificationFilter) args[1];
            Object handback = args[2];

            // This will send along the real ObjectName and not the Proxy name.
            server.addNotificationListener(objectName, notiListener, filter, handback);
            return null;
        }
        else if (methodName.equals("removeNotificationListener") && args != null)
        {
            NotificationListener notiListener = (NotificationListener) args[0];

            // This will send along the real ObjectName and not the Proxy name.
            server.removeNotificationListener(objectName, notiListener);
            return null;
        }
View Full Code Here

Examples of javax.management.NotificationListener

    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

Examples of javax.management.NotificationListener

    OMemoryWatchDog.setPercentageUsageThreshold(iThreshold);

    final MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();

    final NotificationEmitter memEmitter = (NotificationEmitter) memBean;
    memEmitter.addNotificationListener(new NotificationListener() {
      public 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

Examples of javax.management.NotificationListener

      monitor.setGranularityPeriod(1000);
      monitor.setObservedAttribute("ObjectCounter");

      final MutableInteger times = new MutableInteger(0);
      final MutableObject holder = new MutableObject(null);
      monitor.addNotificationListener(new NotificationListener()
      {
         public void handleNotification(Notification notification, Object handback)
         {
            times.set(times.get() + 1);
            holder.set(notification);
View Full Code Here

Examples of javax.management.NotificationListener

      counter.setIntegerCounter(initThreshold.intValue() - 1);

      final MutableInteger times = new MutableInteger(0);
      final MutableObject holder = new MutableObject(null);
      monitor.addNotificationListener(new NotificationListener()
      {
         public void handleNotification(Notification notification, Object handback)
         {
            times.set(times.get() + 1);
            holder.set(notification);
View Full Code Here

Examples of javax.management.NotificationListener

      counter.setIntegerCounter(initThreshold.intValue() - 1);

      final MutableInteger times = new MutableInteger(0);
      final MutableObject holder = new MutableObject(null);
      monitor.addNotificationListener(new NotificationListener()
      {
         public void handleNotification(Notification notification, Object handback)
         {
            times.set(times.get() + 1);
            holder.set(notification);
View Full Code Here

Examples of javax.management.NotificationListener

   }

   public Integer addNotificationListener(ObjectName name, Object filter, Subject delegate) throws InstanceNotFoundException, IOException
   {
      Integer id = notificationHandler.generateListenerID(name, null);
      NotificationListener listener = notificationHandler.getServerNotificationListener();
      getServer().addNotificationListener(name, listener, null, id);
      notificationHandler.addNotificationListener(id, new NotificationTuple(name, listener, null, id));
      return id;
   }
View Full Code Here

Examples of javax.management.NotificationListener

            // 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

Examples of javax.management.NotificationListener

         }
      }

      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Sending Notification " + notif + ", listener info is " + tuple);

      NotificationListener listener = tuple.getNotificationListener();

      try
      {
         listener.handleNotification(notif, tuple.getHandback());
      }
      catch (Throwable x)
      {
         logger.warn("Throwable caught from handleNotification, listener = " + listener, x);
         // And return quietly
View Full Code Here

Examples of javax.management.NotificationListener

      MBeanServerDelegateMBean delegate = (MBeanServerDelegateMBean)proxy;

      System.out.println(delegate.getImplementationVendor() + " is cool !");

      // Register an MBean, and get notifications via the Hessian protocol
      connection.addNotificationListener(delegateName, new NotificationListener()
      {
         public void handleNotification(Notification notification, Object handback)
         {
            System.out.println("Got the following notification: " + notification);
         }
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.