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. Managed Beans are particularly used in the Java Management Extensions technology.

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 two basic types of MBean:

  • Standard MBeans implement a business interface containing setters and getters for the attributes and the operations (i.e., methods).
  • Dynamic MBeans implement the javax.management.DynamicMBean interface which provides a way to list the attributes and operations, and to get and set the attribute values.

Additional types are Open MBeans, Model MBeans and Monitor MBeans.

Open MBeans are dynamic MBeans that rely on the basic data types. They are self-explanatory and more user friendly.

Model MBeans are dynamic MBeans that can be configured during runtime. A generic MBean class is also provided for dynamically configuring the resources during program runtime.

[edit] MBean Registration

The registration of an MBean in the MBeanServer (i.e., 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 as memory pools, garbage collection, multi-threading, class loading, JIT compilation, etc.

[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>

[edit] External Link