Package javax.management

Examples of javax.management.StandardMBean$MBeanInfoSafeAction

In either case, the class Impl must implement the interface Intf.

Standard MBeans based on the naming relationship between implementation and interface classes are of course still available.

This class may also be used to construct MXBeans. The usage is exactly the same as for Standard MBeans except that in the examples above, the {@code false} parameter to the constructor or{@code super(...)} invocation is instead {@code true}.

@since 1.5

   public void testMBeanInterfaceOldStyle()
      throws Exception
   {
      Object obj = new Trivial();
      StandardMBean std = new StandardMBean(obj, null);
      assertTrue("Trivial has TrivialMBean as a management interface", TrivialMBean.class == std.getMBeanInterface());
   }
View Full Code Here


   }

   public void testMetaData()
      throws Exception
   {
      StandardMBean std = new MyStandardMBean();
      MBeanInfo info = std.getMBeanInfo();
      assertEquals(MyStandardMBean.MBEAN_CLASSNAME, info.getClassName());
      assertEquals(MyStandardMBean.MBEAN_DESCRIPTION, info.getDescription());

      MBeanAttributeInfo[] attributes = info.getAttributes();
      assertEquals(attributes.length, 1);
View Full Code Here

   }

   public void testNoConstructorsMetaData()
      throws Exception
   {
      StandardMBean std = new NoConstructorsStandardMBean();
      MBeanInfo info = std.getMBeanInfo();

      MBeanConstructorInfo[] constructors = info.getConstructors();
      assertEquals(constructors.length, 0);
   }
View Full Code Here

   }

   public void testCaching()
      throws Exception
   {
      StandardMBean std = new MyStandardMBean();
      MBeanInfo info = std.getMBeanInfo();
      assertTrue("MBeanInfo should be cached", info == std.getMBeanInfo());
   }
View Full Code Here

      throws Exception
   {
      boolean caught = false;
      try
      {
         new StandardMBean(null, Runnable.class);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      assertTrue("Expected IllegalArgumentException for null implementation", caught);

      caught = false;
      try
      {
         new StandardMBean(new MyRunnable(), ArbitraryInterface.class);
      }
      catch (NotCompliantMBeanException e)
      {
         caught = true;
      }
      assertTrue("Expected NotCompliantMBeanException for the wrong management interface", caught);

      caught = false;
      try
      {
         new StandardMBean(new MyRunnable(), null);
      }
      catch (NotCompliantMBeanException e)
      {
         caught = true;
      }
View Full Code Here

                result = new BaseStandardMBean(info.getObjectToManage(),interfaceMBean, description, info.getAttributeInfos(), info
                        .getOperationInfos());
                info.setPropertyChangeListener((BaseStandardMBean)result);
            }
            else {
                return new StandardMBean(theObject, interfaceMBean);
            }
        }
        return result;
    }
View Full Code Here

   */
  void registerMBean() {
    // We wrap to bypass standard mbean naming convetion.
    // This wraping can be removed in java 6 as it is more flexible in
    // package naming for mbeans and their impl.
    StandardMBean bean;
    try {
      bean = new StandardMBean(this,FSNamesystemMBean.class);
      mbeanName = MBeanUtil.registerMBean("NameNode", "FSNamesystemStatus", bean);
    } catch (NotCompliantMBeanException e) {
      e.printStackTrace();
    }

View Full Code Here

        try
        {
            try
            {
                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                mbs.registerMBean(new StandardMBean(new NativeAccess(), NativeAccessMBean.class), new ObjectName(MBEAN_NAME));
            }
            catch (Exception e)
            {
                logger.error("error registering MBean " + MBEAN_NAME, e);
                //Allow the server to start even if the bean can't be registered
View Full Code Here

        try
        {
            try
            {
                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                mbs.registerMBean(new StandardMBean(new NativeAccess(), NativeAccessMBean.class), new ObjectName(MBEAN_NAME));
            }
            catch (Exception e)
            {
                logger.error("error registering MBean " + MBEAN_NAME, e);
                //Allow the server to start even if the bean can't be registered
View Full Code Here

    }
   
    try {
      OBJECT_NAME = new ObjectName("accumulo.server.metrics:service=TServerInfo,name=TabletServerMBean,instance=" + Thread.currentThread().getName());
      // Do this because interface not in same package.
      StandardMBean mbean = new StandardMBean(this, TabletServerMBean.class, false);
      this.register(mbean);
      mincMetrics.register();
    } catch (Exception e) {
      log.error("Error registering with JMX", e);
    }
View Full Code Here

TOP

Related Classes of javax.management.StandardMBean$MBeanInfoSafeAction

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.