Managed Bean
From Wikipedia, the free encyclopedia
In the JMX API, a managed bean - sometimes simply referred to as an MBean - is a type of JavaBean, created with dependency injection. The MBean represents a resource running in the Java Virtual Machine such as an application, a J2EE technical service (transactional monitor, JDBC driver, ...), ... They can be used for getting and setting applications configuration (pull), for collecting statistics (pull) (e.g. performance, resources usage, problems, ...) and notifying events (push) (e.g. faults, state changes, ...)
Contents |
[edit] MBean Types
There are 2 basic types of MBean :
- Standard MBeans implement a business interface containing setters and getters for the attributes and the operations (ie methods).
- Dynamic MBeans implement the javax.management.DynamicMBean interface which provides the way to list the attributes, to list the operations and to set/get the attributes values.
Additional types are Open MBeans, Model MBeans and Monitor MBeans.
Open MBeans are the dynamic MBeans that rely on the basic data types. These type of Beans are self explanatory and more user friendly.
Model MBeans are the dynamic MBeans that can be configured during the run-time. A generic MBean class is also provided for dynamically configuring the resources during the run-time of the program.
[edit] MBean Registration
The registration of an MBean in the MBeanServer (ie the agent) requires a unique identifier called ObjectName. The ObjectName pattern is composed of two parts. The first one indicates the domain since the second one is a list of name-value pairs. Registered MBeans can be searched using wildcards in the ObjectName (e.g *:type=Memory*)
[edit] MBean Notification
An MBean can notify the MBeanServer of its internal changes (for the attributes) by implementing the javax.management.NotificationEmitter. The application interested in the MBean's changes registers a listener (javax.management.NotificationListener) to the MBeanServer.
[edit] MXBean
An MXBean (Platform MBean) is a special type of MBean that reifies Java Virtual Machine subsystems such memory pools, garbage collection, multi-threading, class loading, JIT compilation ...
[edit] MLet
MLet (Management applet) is a utility MBean to load, instantiate and register MBeans in the MBeanServer from a XML description. The format of the XML descriptor is :
<MLET CODE = ''class'' | OBJECT = ''serfile'' ARCHIVE = ''archiveList'' [CODEBASE = ''codebaseURL''] [NAME = ''objectName''] [VERSION = ''version''] > [arglist] </MLET>