Contents | Previous | Next Java Management Extensions (JMX) Technology Overview

Chapter   3

Instrumenting Your Resources for JMX Technology

This chapter outlines the concepts behind instrumenting resources for management using JMX technology, in the following sections:

Manageable Resources

Different types of resource can be managed using JMX technology, for example an application, an implementation of a service, a device or a user. For a given resource to be managed by JMX technology, it must be developed in the Java language, or at least offer a Java language wrapper. It must also be instrumented by one or more Java objects known as managed beans (MBeans), in compliance with the JMX specification.

Developers of applications and devices are free to choose the granularity of objects that are instrumented as MBeans. An MBean might represent the smallest object in an application, or it could represent the entire application. Application components designed with their management interface in mind can typically be written as MBeans. MBeans can also be used as wrappers for legacy code without a management interface or as proxies for code with a legacy management interface.

Managed Beans (MBeans)

The Java objects that implement resources and their instrumentation are called managed beans, or MBeans. MBeans must follow the design patterns and interfaces defined in the JMX specification (JSR 3). This ensures that all MBeans provide the instrumentation of managed resources in a standardized way.

The instrumentation of a given resource is provided by one or more MBeans that are either standard or dynamic. Standard MBeans are Java objects that conform to certain design patterns derived from the JavaBeansTM component model. Dynamic MBeans conform to a specific interface that offers more flexibility at runtime.

The instrumentation of a resource allows it to be manageable through the agent level described in Chapter 4, "Using JMX Agents". MBeans do not require knowledge of the JMX agent with which they operate.

MBeans are designed to be flexible, simple, and easy to implement. Developers of applications, services, or devices can make their products manageable in a standard way without having to understand or invest in complex management systems. Existing objects can easily be evolved to produce standard MBeans or wrapped as dynamic MBeans, thus making existing resources manageable with minimum effort.

In addition, the instrumentation level also specifies a notification mechanism. This allows MBeans to generate and propagate notification events to components of the other levels.

The management interface of an MBean consists of:

The Java class of a standard MBean exposes the resource to be managed directly through its attributes and operations. Attributes are internal entities that are exposed through getter and setter methods. Operations are the other methods of the class that are available to managers. All these methods are defined statically in the MBean interface and are visible to a JMX agent through introspection. This is the most straightforward way of making a new resource manageable.

A dynamic MBean is an MBean that defines its management interface at runtime. For example, a configuration MBean could determine the names and types of the attributes it exposes by parsing an XML file.

JVM Instrumentation

The Java Virtual Machine (JVM) is highly instrumented using JMX technology. You can easily start a JMX agent to access the built-in JVM instrumentation, and thereby monitor and manage the JVM remotely by means of JMX technology.

 


Contents | Previous | Next Java Management Extensions (JMX) Technology Overview
Java Management Extensions (JMX), Java 2 Platform, Standard Edition 5.0