Chapter 8. Dynamic Loading

In this chapter, we will discuss a facility provided by JMX that allows MBeans to be loaded into an agent dynamically. This facility, called the M-Let (short for management applet) service, is the first agent-level service we have discussed so far. There are two major sections in this chapter. The first section is an overview of the M-Let service, including the various facets of it that make it work. The second section deals with the details of the M-Let service and provides examples of code that executes in the JMX agent that uses the M-Let service.

Overview

In this section, we will look at the M-Let service, whose purpose is to provide an agent with a means to load MBeans from a Universal Resource Locator (URL). There are two ways that an agent can use the M-Let service to accomplish this. First, the agent can specify an M-Let file to the M-Let service, which uses the contents of this file to load the MBeans. The M-Let file is an XML-like text file that contains various tags that describe the MBeans to be loaded. The second method of loading MBeans is to use the M-Let service itself to load the MBeans without the use of an M-Let file. The M-Let service extends URLClassLoader from the java.net package and is thus capable of fetching bytecode from any valid URL into the JVM in which the agent is running.

The M-Let Service

In the RI, the M-Let service is implemented in a class called MLet, which implements an interface called MLetMBean (so it is instrumented ...

Get Java Management Extensions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.