1 Reply Latest reply on Nov 19, 2004 3:31 PM by Dimitris Andreadis

    Wrapping POJOs as Mbeans


      If I understand correctly...

      I should be able to use my pojo as a service just by providing a jboss-service.xml file.

      So something to the likes of...

      <?xml version="1.0" encoding="UTF-8"?>
       <mbean code="package.Mypojo" name="package:service=MyPojoService">
       <attribute name="Message">Hello World</attribute>


      If I wanted MyPojo to be started and stoped through the Jboss service events startService, stopService etc... Would I need to wrapy my pojo in an XMbean and define the operations?

      Also when would I actually want to implement MyPojo using the ServiceMean and ServiceMbeanSupport interafce and class?


        • 1. Re: Wrapping POJOs as Mbeans
          Dimitris Andreadis Master

          If you want to make your POJO appear as an MBean you *must* use an mbean + xmbean descriptor.

          Extending ServiceMBeanSupport is useful if you want to do things like produce or consume notifications, invoke on other MBeans, etc., in general things that translate to your class having knowledge of JMX.

          You can also do both, i.e extend ServiceMBeanSupport *and* use an mbean+xmbean descriptor

          Using the xmbean descriptor allows you to:

          add rich metadata descriptions
          produce automatically AttributeChangeNotification on attribute updates
          persist attribute changes
          cache attribute values
          add your own interceptors