Tutorials : Java Management Extensions :

Java Management Extensions:

Introduction:

Imagine a system that has pluggable modules included into it, that you could expand on as needed. Add to that the capability of integrating seamlessly with existing applications and leveraging on their power. All the ideas above and much more form the gist of what JMX or Java Management Extensions wishes to bring to the Java world.

In technical terms the Java Management Extensions provides an architecture and API for application management and network management using the Java programming language. It allows Integrators to integrate independent Java agent modules into existing systems.

Architecture

The two most important components of the JMX specifications are the Instrument Level and the Agent Level. The instrumentation level is a specification that defines the implementation of JMX manageable resources. A JMX manageable resource can be an application, a service or a device. The only condition is that the resource needs to be written in Java or should have a Java wrapper. It also should have been instrumented so that it can be managed by JMX complaint applications. The instrumentation is provided by Managed beans or MBeans. The instrumentation layer creates resources so that they can be managed by Management agents. The MBeans are designed to be generic, flexible and easy to implement. They do not require the user to know the JMX agents they would operate on. Apart from these, the instrumentation specification provides a mechanism to notify events, this allows MBeans to generate and notify other components of events.

The agent level defines the specification for implementing Management agents. Management agents or MBeans control the resources and make them available to the other applications. This level acts as an interface to the instrumentation layer by providing a standardized agent to manage the JMX resources. An agent consists of an MBean server and a set of services to handle MBeans. JMX agents provide the infrastructure and API for developers to use MBeans or resources provided by the MBean server. They need not know about the internal implementation of these resources or MBeans. The instrumentation specification and the agent specification are discussed in more detail below.

Instrumentation Layer:

The main components of the instrumentation layer are the MBeans, the Notification model and the MBean metadata classes.

MBeans: An MBean is a concrete Java class that includes the implementation of its own MBean interface or an implementation of the DynamicMBean interface. It can also optionally implement the NotificationBroadcaster interface.

A class that implements its own MBean interface is referred to as a standard MBean. This is the simplest type of instrumentation available when developing new JMX manageable resources. An MBean that implements the DynamicMBean interface is known as a dynamic MBean, because certain elements of its instrumentation can be controlled at runtime. The type of MBean determines how the MBean is deployed on the MBean Server but it has no effect on how the bean is managed. JMX agents are designed to shield the type of MBean and provide a standard interface. The end user is transparent to the type of bean.

A standard MBean consists of attributes and operations. The attributes can be accessed using getter and setter methods. The operations are static methods in the MBean interface and are visible to JMX agents using introspection. The Dynamic MBean allows manipulations on its methods through generic invocation methods. The method could take the name of the attribute or the operation as a parameter.

Notification Model: Usually management applications need to react to state changes or to specific conditions when they occur in an underlying resource. The Notification Model defines a model that allows MBeans to broadcast such management events, called notifications. Management applications and other objects register as listeners with the broadcaster MBean. The MBean Notification Model of JMX enables a listener to register only once and still receive all the different events that might occur in the broadcaster.

The JMX Notification Model uses a generic class called Notification to define an event type. This class may be sub- classed to represent specific types of events. The generic event type allows a single listener to receive numerous notifications from different types of notification types. Objects desiring to receive notifications sent by MBeans must implement the NotificationListener interface. MBeans that want to broadcast notifications have to implement the NotificationBroadcaster interface, so that it can allow listeners to register themselves with the MBean to receive notifications. Any type of MBean, standard or dynamic, can be either a notification broadcaster, a notification listener, or both at the same time.

MBean Metadata Classes: The MBean metadata defines the classes that describe an MBean. These classes are used both for the introspection of standard MBeans and for the self description of all dynamic MBeans. These classes describe the management interface of an MBean in terms of its attributes, operations, constructors and notifications. The JMX agent exposes all its MBeans, regardless of their type, through the MBean metadata classes. All clients, whether management applications or other local MBeans viewing the management interface of an MBean, need to be able to interpret these objects and their constructs.

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.