Package javax.management.monitor

Examples of javax.management.monitor.CounterMonitor


    @Override
    protected void initBean() throws Exception {
        // add the simple bean
        super.initBean();
        // add our monitor bean
        CounterMonitor monitor = new CounterMonitor();
        monitor.addObservedObject(makeObjectName("simpleBean"));
        monitor.setObservedAttribute("MonitorNumber");
        monitor.setNotify(true);
        monitor.setInitThreshold(1);
        monitor.setGranularityPeriod(500);
        registerBean(monitor, makeObjectName("counter"));
        monitor.start();
    }
View Full Code Here


      expected.add(MonitorNotification.OBSERVED_OBJECT_ERROR);
      expected.add(MonitorNotification.RUNTIME_ERROR);
      expected.add(MonitorNotification.THRESHOLD_ERROR);
      expected.add(MonitorNotification.THRESHOLD_VALUE_EXCEEDED);

      MBeanNotificationInfo[] mbni = new CounterMonitor().getNotificationInfo();
      checkNotificationInfo("Counter", mbni, expected);
   }
View Full Code Here

   private void initCounterMonitor(boolean notify, Number threshold,
        boolean differenceMode, Number offset, Number modulus)
   {
      try
      {
         CounterMonitor counterMonitor = new CounterMonitor();
         counterMonitor.setNotify(notify);
         counterMonitor.setThreshold(threshold);
         counterMonitor.setDifferenceMode(differenceMode);
         counterMonitor.setOffset(offset);
         counterMonitor.setModulus(modulus);
         CounterSupport support = new CounterSupport();
         monitor = counterMonitor;
         monitored = support;
         initMonitor();
      }
View Full Code Here

   */
  private void startCounterService(boolean mode, int modulus,
                                   int offset, int threshold)
    throws Exception
  {
    installMonitorService(new CounterMonitor());
    AttributeList attributes = new AttributeList();
    attributes.add(new Attribute("DifferenceMode", new Boolean(mode)));
    attributes.add(new Attribute("Modulus", new Integer(modulus)));
    attributes.add(new Attribute("Offset", new Integer(offset)));
    attributes.add(new Attribute("Notify", new Boolean(true)));
View Full Code Here

{
  /**
   */
  AMXCounterMonitorImpl()
  {
    super( new CounterMonitor() );
  }
View Full Code Here

      super(name);
   }

   protected Monitor createMonitor()
   {
      return new CounterMonitor();
   }
View Full Code Here

      return new CounterMonitor();
   }

   public void testCorrectInitialization() throws Exception
   {
      CounterMonitor monitor = (CounterMonitor)createMonitor();
      assertEquals(new Integer(0), monitor.getInitThreshold());
      assertEquals(new Integer(0), monitor.getModulus());
      assertEquals(new Integer(0), monitor.getOffset());
      assertFalse(monitor.getDifferenceMode());
      assertFalse(monitor.getNotify());
   }
View Full Code Here

      assertFalse(monitor.getNotify());
   }

   public void testSetThreshold() throws Exception
   {
      CounterMonitor monitor = (CounterMonitor)createMonitor();
      try
      {
         monitor.setThreshold(new Integer(-1));
         fail();
      }
      catch (IllegalArgumentException x)
      {
      }
      try
      {
         monitor.setInitThreshold(new Integer(-1));
         fail();
      }
      catch (IllegalArgumentException x)
      {
      }

      Integer threshold = new Integer(1);
      monitor.setThreshold(threshold);
      assertEquals(monitor.getInitThreshold(), threshold);

      threshold = new Integer(2);
      monitor.setInitThreshold(threshold);
      assertEquals(monitor.getInitThreshold(), threshold);
   }
View Full Code Here

      assertEquals(monitor.getInitThreshold(), threshold);
   }

   public void testSetModulus() throws Exception
   {
      CounterMonitor monitor = (CounterMonitor)createMonitor();
      try
      {
         monitor.setModulus(new Integer(-1));
         fail();
      }
      catch (IllegalArgumentException x)
      {
      }

      Integer modulus = new Integer(1);
      monitor.setModulus(modulus);
      assertEquals(monitor.getModulus(), modulus);
   }
View Full Code Here

      assertEquals(monitor.getModulus(), modulus);
   }

   public void testSetOffset() throws Exception
   {
      CounterMonitor monitor = (CounterMonitor)createMonitor();
      try
      {
         monitor.setOffset(new Integer(-1));
         fail();
      }
      catch (IllegalArgumentException x)
      {
      }

      Integer offset = new Integer(1);
      monitor.setOffset(offset);
      assertEquals(monitor.getOffset(), offset);
   }
View Full Code Here

TOP

Related Classes of javax.management.monitor.CounterMonitor

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.