Examples of addNotificationListener()


Examples of javax.management.NotificationEmitter.addNotificationListener()

        MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();

        NotificationEmitter emitter = (NotificationEmitter) mbean;

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

Examples of javax.management.NotificationEmitter.addNotificationListener()

   public void register(NotificationListener listener) {
      if (this.pool != null) {
         // register for notification ...
         MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
         NotificationEmitter emitter = (NotificationEmitter) mbean;
         emitter.addNotificationListener(listener, null, this.pool);
      }
   }

   /**
    * Tester: java -Xms2M -Xmx3M -Dcom.sun.management.jmxremote -DxmlBlaster/jmx/exitOnMemoryThreshold=true org.xmlBlaster.util.admin.extern.LowMemoryDetector
View Full Code Here

Examples of javax.management.NotificationEmitter.addNotificationListener()

    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.NotificationEmitter.addNotificationListener()

        // prepare the dump location
        setDumpLocation(null);

        // register for memory threshold notifications
        NotificationEmitter memEmitter = (NotificationEmitter) getMemory();
        memEmitter.addNotificationListener(this, null, null);

        // set the initial automatic dump threshold
        int defaultThreshold;
        String propThreshold = context.getProperty(MemoryUsageConstants.PROP_DUMP_THRESHOLD);
        if (propThreshold != null)
View Full Code Here

Examples of javax.management.j2ee.ListenerRegistration.addNotificationListener()

         ObjectName lMail = (ObjectName) names.iterator().next();
         Listener lLocalListener = new Listener();
         ListenerRegistration lListenerFactory = jsr77MEJB.getListenerRegistry();
         getLog().debug("+++ testNotificationDeliver, add Notification Listener to " + TEST_MAIL +
            " with Listener Registry: " + lListenerFactory);
         lListenerFactory.addNotificationListener(
            lMail,
            lLocalListener,
            null,
            null
         );
View Full Code Here

Examples of javax.management.monitor.CounterMonitor.addNotificationListener()

    cm.setGranularityPeriod(monitoringFrequency);
    cm.setNotify(true);
    cm.setInitThreshold(new Long(threshold));
    cm.setDifferenceMode(true);
    cm.setNotify(true);
    cm.addNotificationListener(new CounterListener(),null,null);
    try {
      ObjectName objectNameC = new ObjectName("XFire:name="+serviceName+"CounterMonitor,"+"type=management");
      cm.start();
      mbs.registerMBean(cm, objectNameC);
   
View Full Code Here

Examples of javax.management.monitor.GaugeMonitor.addNotificationListener()

    gm.setGranularityPeriod(monitoringFrequency);
    gm.setNotifyHigh(true);
    gm.setNotifyLow(true);
    gm.setThresholds(thresholdHigh,thresholdLow);
    gm.setDifferenceMode(true);
    gm.addNotificationListener(new GaugeListener(),null,null);
    try {
      ObjectName objectNameG = new ObjectName("XFire:name="+serviceName+"GaugeMonitor,"+"type=management");
      gm.start()
      mbs.registerMBean(gm, objectNameG);
   
View Full Code Here

Examples of javax.management.monitor.Monitor.addNotificationListener()

      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.monitor.StringMonitor.addNotificationListener()

                            domain + ":type=" + StringMonitor.class.getName());
            stringMonitor = new StringMonitor();
            server.registerMBean(stringMonitor, stringMonitorName);

            echo(">>> ADD a listener to the StringMonitor");
            stringMonitor.addNotificationListener(this, null, null);

            //
            // MANAGEMENT OF A STANDARD MBEAN
            //
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer.addNotificationListener()

         cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, getEnvironment(), newMBeanServer());
         cntorServer.start();
         sleep(5000);

         final MutableObject holder = new MutableObject(null);
         cntorServer.addNotificationListener(new NotificationListener()
         {
            public void handleNotification(Notification notification, Object handback)
            {
               holder.set(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.