Java Management Extensions

from Wikipedia, the free encyclopedia

Java Management Extensions ( JMX ) is a specification developed by the Java Community Process (JSR-3) for managing and monitoring Java applications . Parts of the JMX specification are already integrated in the Java 1.5 standard API and have been greatly expanded with Java 6 . JMX is not only a suitable technology to control the behavior of systems, but also facilitates the communication of different Java programs. In the original API, JMX only supported communication within a JVM ( Java Virtual Machine ), but since Java version 6 it has also supported communication with other JVMs. This is possible through the support of adapters and connectors . This makes it easy to implement an HTTP adapter and the application can be controlled via a web browser . If the system is to be integrated into an existing managed network, adapters for SNMP or CIM / WBEM can be added to the application.

Infrastructure

JMX is divided into three main levels.

JMX levels
Surname description
Distributed Services Level This level has not yet been defined in the specification; its actual task is to provide interfaces for communication with components of the agent level. (This can be, for example, an Internet browser or a specially written client.)
Agent level At this level, agents are defined that are responsible for communication with the resources of the instrumentation level.
Instrumentation level Resources (components to be managed) that are monitored or configured with the help of MBeans are located at this level .

The so-called MBeans are registered in the instrumentation level. These Java objects are managed by so-called agents. The MBeans can be accessed directly via the Distributed Service Level. The visibility is defined in the MBeans. Ready-made HTTP adapters for JMX are available, which makes it possible to change values ​​of a Java application directly via a web browser.

JConsole

JConsole is a GUI program from Sun that can be used to manage MBeans. It has been included as standard since JDK 1.5.

JConsole at a glance

Types of MBeans (Managed Beans)

Various types of MBeans have become established in recent years to cope with a wide variety of tasks.

  • Standard MBean
  • Dynamic MBean
  • Model MBean
  • Open MBean

The standard MBeans can be formed by defining interfaces whose names end with "MBean".

Dynamic MBeans are built during runtime and can also be changed during runtime. Currently, attributes and methods can only be described for the dynamic MBeans. This will only be possible with standard MBeans with the help of annotations.

The Model MBeans are very similar to the dynamic ones , but also have a "read" and "write" method with which values ​​are saved in a file or in a database. OnTimer functions can be used here, or logging can be defined using the notification handler. Another advantage of the Model MBeans is that they can be created directly in the agent.

The Open MBeans only have the standard Java types available, but with this property they have better possibilities to communicate with other programs outside the project.

Services from JMX

JMX also provides various services that are interesting for handling and monitoring.

  • M-Let service
  • Timer service
  • monitor

The M-Let Service offers the option of reloading classes during execution time. This process can be automated via version control, using the bootstrap class loader .

Periodic system observations can be carried out with the timer service . Notifications are thrown at predefined time intervals that can be intercepted and processed by a listener.

With the monitor class, individual variables (observables) of an MBean can be observed without their internal structure having to be known. There are three types derived from this monitor.

  • Counter monitor
  • Gauge monitor
  • String monitor

The counter monitor is mainly suitable for periodic observations. The gauge monitor can monitor adherence to predefined limits and throws a notification when the event occurs . The string monitor monitors the observables to see whether they stay the same or whether they change.

Implementations

The following Java applications (especially application servers and servlet containers) offer an implementation of JMX that goes beyond the implementation delivered with the Java Runtime Environment since Java 5 :

literature

  • J. Steven Perry: Java Management Extensions . O'Reilly, ISBN 0-596-00245-9
  • Marc Fleury, Juha Lindfors: JMX: Managing J2EE with Java Management Extensions . Sams Publishing, ISBN 0-672-32288-9
  • Jeff Hanson: Connecting JMX Clients and Servers: Understanding the Java Management Extensions . APress LP, ISBN 1-59059-101-1
  • Benjamin G. Sullins: Mark B Whipple: JMX in Action: You will also get your first JMX application up and running . Manning Publications, 2002, ISBN 1-930110-56-1
  • Lars Wunderlich: Managing Java . Developer Press, ISBN 978-3-939084-13-6

Web links

items