Architecture & DesignThe Key Aspects of Java's Monitoring and Management APIs

The Key Aspects of Java’s Monitoring and Management APIs content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

The Monitoring and Management Services is one of the less frequently used features of Java, not because they are unimportant or one can do away with them, but because they are meant to be used under special circumstances. It is specifically for those developers and system administrators for whom performance of their application is crucial and need some utilities to gauge and manage it. Java provides extensive support for comprehensive treatment in this respect. It is, however, not possible to provide an entire overview of monitoring and management feature of the Java Platform; this article tries to be quick and brief in delineating the key aspects of this technology.

An Overview

The Monitoring and Management features provided by Java Platform can be categorised grossly as:

  • Java Virtual Machine Instrumentation
  • Monitoring and Management API
  • Monitoring and Management Tools
  • Java Management Extension (JMX) Technology

Java Virtual Machine Instrumentation

Referred to as an out-of-the-box management tool for JVM, it provides a built-in mechanism to monitor JVM and applications running on it, both locally and from a remote machine. The application should be set up appropriately to enable this feature during execution. Java Platform makes use of the Java Management Technology (JMX) technology to implement this feature. To enable this feature, we need to create a JMX agen,t called MBean (Managed Bean), and then register it to the MBean server. The MBeans are nothing but Java objects that represent resources to be managed. Now, to make JMX agent able to monitor and manage JVM, we must set some system properties during JVM start-up, such as:

java -Dproperty=value
Property Value Short Description True/false Enables/disables JMX agent from local or remote monitoring using JMX connectors. Default is true. Port number Sets port number for JMX connector to listen through. True/false Binds RMI connector stub to an RMI registry. Default is false. True/false Enables/disables secure monitoring with SSL. Default is true. SSL/TLS protocols Shows list of SSL/TLS protocols that can be enabled using SSL/TLS cipher suites Shows list of SSL/TLS cipher suites that can be enables using True/false Determines whether to perform client authentication. Default is false. True/false Prevents JMX from using password or access files. Default is true. File path Specifies location of the password file. File path Specifies location of the access file.   Specifies name of the Java Authentication and Authorization Service (JAAS) login configuration entry used by JMX agent while authenticating users.

For example, local monitoring may be enabled as follows:

$ java    -jar MyApp.jar

Remote monitoring may be enabled as follows:


If no property is set at start-up for property management, it then uses the default value.

Monitoring and Management APIs

The Monitoring and Management APIs are packaged under They provide the programming interface for managing and monitoring JVM and underlying operating system dynamically at runtime. The APIs provide the functionality to monitor and manage JVM, both at the remote and local levels, as well as the application that can monitor them. One can access dynamic information about:

  • Loaded classes
  • The running threads, such as their state, contention statistics, and stack trace
  • The status of the memory consumed by the running application
  • The statistical information of garbage collection
  • Deadlock detection
  • Underlying operating system

The logging information can be retrieved through the PlatformLoggingMXBean interface declared in the package, under the module, as per Java 9 recommendation. Prior to version 9, and until Java 8, logging information was retrieved by the LoggingMXBean interface declared in the java.util.logging package. The methods declared in LoggingMXBean are deprecated now.

The API also provides necessary interface to access JConsole as a plug-in from an existing application.

Monitoring and Management Tools

The primary Monitoring and Management tool supplied by Java SE is JConsole. It is a tool that provides memory, thread, classes, JVM information, and other information in a graphical window. The runtime statistics are provided with the help of graphs and charts. The JConsole is an implementation of JMX APIs and can be used to monitor runtime performance of JVM or any other application that is specifically instrumented to be monitored.

The JConsole that comes with Java SE 9 has many new enhancement and capabilities. (We’ll cover JConsole in an another article.)

Figure 1: JConsole

Java Management Extension (JMX) Technology

Java Management Extension is a specification developed through Java Management Extension (JSR 3) and JMX Remote API (JSR 160). The JMX API is specifically used to manage and monitor Java Platform resources such as the JVM itself, devices, services provided by it, and the application running on it.

According to Java Platform SE Management and Extension Guide, the JMX specification defines in the Java programming language an architecture, the design patterns, the APIs, and the services for application and network management and monitoring.

To use this technology, one or more Java objects, known as Managed Beans (MBeans), instruments a specified resource. These MBeans are registered in a core managed object server, known as an MBean server. The MBean server acts as a management agent and can run on most devices enabled for the Java programming language.

Defining MBean is simple. If we want to write an MBean of a class, say, MyClass, we need to create an interface names as MyClassMBean and implement this interface by the MyClass. For example:

package org.mano.jmx.examples;
public interface ConverterMBean {
   public double celciusToFahrenheit(doublecelcius);

package org.mano.jmx.examples;
public class Converter implementsConverterMBean {
   public double celciusToFahrenheit(doublecelcius) {
      // ...
      return 0;

Therefore, a standard MBean is composed of the MBean interface which lists the methods for all exposed attributes and operations, and the class which implements this interface and provides the functionality of the instrumented resource.

To manage the resource, a JMX agent has to be created and registered to the MBean Server. Here is a sample.

package org.mano.jmx.examples;
public class Main {
   public static void main(String[] args) throwsException{
      MBeanServer server= ManagementFactory
      ObjectName objName=newObjectName
      Converter mbean=newConverter();

There is another type of MBean, called MXBean. MXBeans are written in code in a similar manner as MBean. The difference is that MXBeans are made type-free to make them compatible with potential clients. Also, they are simpler than standard MBeans. For example, an MBean exposes attributes of its data type where the client must have the same attribute type to make sense of it; MXBeans makes use of the existing types such as primitive types, Strings and composition, and so forth. The advantage is that an MXBean can make use of the existing types without loading the specific type and make them interoperable with non-Java clients as well.


The crux of the matter is that Java Monitoring and Management Services are built around the JMX technology. Therefore, it is crucial to understand JMX before even getting started with Monitoring and Management Services. The JConsole is a boon to monitoring and managing a Java application. It provides the necessary information to monitor what goes beneath a running application and fine tune it efficiently apart from managing and monitoring JVM at runtime, be it remotely or locally.


Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories