1 Reply Latest reply on Oct 28, 2003 6:17 AM by adrian.brock

    MBeanProxy Vs MBeanServer.getAttribute

    yoge_babu

      Which is the efficient way to access MBean Attributes ??

      What is the advantage in using MBeanProxy to access the MBean information?

      Will the below code snippet be efficient or should I go for direct mbeanserver.getAttribute ?
      ---------------------------------------------------------------------
      MBeanServer server=(MBeanServer )((java.util.ArrayList)MBeanServerFactory.findMBeanServer(null)).get(0);

      ObjectName oname=new ObjectName("jboss.management.local:j2eeType=J2EEServer,name=Local");

      J2EEServerMBean mbean = (J2EEServerMBean)MBeanProxy.get(J2EEServerMBean.class, oname, server);

      mbean.getServerVersion();
      ---------------------------------------------------------------------

      Is there any other efficient way to access the MBean Attributes within the JVM?


      Thanks

      Yoge

        • 1. Re: MBeanProxy Vs MBeanServer.getAttribute

          Direct jmx invocations are more efficient than
          the proxy.
          MBeanProxy uses reflection and requires
          getX -> getAttribute('X'); translation

          I doubt you would find the overhead of the
          MBeanProxy significant unless it is in a critical
          section of code.

          Regards,
          Adrian