July 29, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Integrating your Java Application with Existing Network Management Solutions with JMX

  • July 1, 2004
  • By Olexiy & Alexander Prokhorenko
  • Send Email »
  • More Articles »

What is JMX? If you think that it is one more collateral framework, not deserving your attention, you are deeply mistaken. Java Management eXtensions (JMX) is actually one of the most basic functional parts of modern process of applications development and management. Today, this technology is used by such manufacturers of J2EE-servers, as JBoss, WebLogic, and many others. Below, we shall consider the structure of JMX and examples of use of this technology. After perusal of this material, you will be able to implement JMX functionality in own applications without problems.

The technology JMX (Java Management eXtensions) is a rather new Sun Microsystemss standard that allows Java developers to integrate their applications with existing solutions of network management. JMX defines the standard for a creating of JMX-objects, so-called MBeans. MBeans "live" inside the container. Thus, any JMX client (a remote or local application can act as such a client, for example) has an ability to call methods and to get access to MBeans attributes with the help container in which they are located. The application also can receive special notices (messages) from MBeans if this application registers corresponding MBeans.

Configuration management of any application server of appendices can appear a transitory problem, and the majority of projects simply do not include in a cycle of development configuration framework. In this case, JMX comes to the rescue: You will get a multiuse framework to integrate different functions of remote and local management tools into your applications. JMX allows you to request configuration settings and to change them during the application's execution. Besides that, JMX also gives other services, such as monitoring, notices on events, the timer, and dynamic loading of classes from XML files. You can use JMX for loading, initialization, changing, and monitoring of your applications and their distributed components.

The detailed specification of JMX technology is in document JSR-000003 (http://www.jcp.org). After consideration of JMX's architecture, we shall consider examples of how to use JMX together with JSP (Java Server Pages) with the help of the JBoss application server with a JSP/Servlet container, namely Tomcat.

JMX Architecture

The architecture of JMX technology is based on a three-level model. The three logic layers are: instrumentation, agent, and layer of the distributed services (management layer). As a technology, JMX was built with taking into account already existing management technologies; it also gives interfaces to the most widely used reports today: program interfaces for additional management reports give you a means of interaction with other management environments. Clearly, the purpose of these interfaces is closer integration with already existing solutions in the sphere of applications management.

Instrumentation Layer

This layer treats the application as one or several controlled MBean components (Managed Bean). Every MBean gives an opportunity to operate its condition with the help of popular public methods. An MBean can be any Java object that you modify so it supports interfaces and semantics determined in the JMX specification.

There are four types of MBeans: standard, dynamic, open, and model.

  • Standard MBeans provide a static interface.
  • Dynamic MBeans transfer their interface to the JMX agent during application execution with the help of metadata.
  • An Open MBean is the same dynamic MBean, but is uses the predefined types of Java data in a such manner that dependences on other classes are weakened, allowing improved productivity and dynamic behaviour of this component.
  • Model MBean, as follows from the name, is the general and adjustable MBean thatch is delivered with each JMX implementation. You can create a copy and use a model MBean instead of a definition of your own MBean classes.

Standard MBean is the most widespread type. For example, suppose, that you have a class with the name Logger that forms debugging messages of your application, and consists of fields for the log file name (in which these messages will be stored) and a debug level of messages. We can "insert" this Logger class into an MBean with a standard type, creating the new interface with the name LoggerMBean. In this interface, we add public getter and setter methods to install and change values of a file name and debug level. These methods for changing of file name attribute we can call, for example, setFilename() and getFilename(). And, at last, the Logger class needs to implement the LoggerMBean interface so that a JMX agent could analyse and generate independently all the metadata about MBean's Logger class. This that MBean copes, with the help of a JMX agent, with methods calls determined in the interface (in our case, the LoggerMBean interface). Generally, MBean is a communication between a controlled resource (your application) and the rest of the JMX framework.

Agent Layer

Next, the most interesting JMX framework layer is the agent layer. Agent gives remote access to the management of the application to all registered MBeans. It is possible to tell safely that it is the central part of the JMX framework. The agent layer also provides additional services, such as monitoring and dynamic loading of classes. These services also are registered MBeans. The basic component of the agent is called MBean server and is defined by the javax.management.MBeanServer interface. To create a server, you should call the createMBeanServer() static method of te MBeanServerFactory class. This class factory also stores references to all MBean servers that have been created earlier. Therefore, you are not required to cache them. You can find the reference to the necessary MBean server with the help of a findMBeanServer() method.





Page 1 of 3



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel