Getting Started with the Java Dynamic Management Kit 5.0

Generating Proxy MBeans

Generating proxy objects for your MBeans is an optional step that depends on the design of your management application. As discussed earlier in this guide, a proxy is an object that represents an MBean in a remote agent. The manager accesses an MBean by performing operations on the proxy MBean.

Proxy objects simplify the design of your management application because they provide an abstraction of remote resources. Your architecture can assume that resources are local because they appear to be, even if they are not. Of course, proxies have greater response times than local resources, but the difference is usually negligible.

Using proxies also simplifies the code of your application. Through the connector client, the proxy object handles all communication details. Your code invokes a method that returns a value, and the complete mechanism of performing the remote management request is hidden. This object-oriented design of having a local object represent a remote resource is fully in the spirit of the Java programming language.

Assuming that a management application has already established the connection to an agent, the overhead of a proxy object is minimal, both in terms of resource usage and required setup. However, it is common sense to instantiate proxies only for resources that will be accessed often or that are long-lived.

The development cost of a proxy MBean is also minimal. Standard proxies are fully generated from their corresponding MBean by using the proxygen compiler supplied with the Java DMK. Generic proxies are part of the Java dynamic management runtime libraries and need only to be instantiated.

You can use of the proxygen tool options to modify the characteristics of the proxies you generate from an MBean. For example, the read-only option generates proxies whose setter methods return exceptions. By generating sets of proxies with different characteristics from the same MBean, you can develop a Java manager whose behavior is modified at runtime, depending on which set is available.

In an advanced management solution where resources are discovered only at runtime, the proxy class can be loaded dynamically in the manager. For example, the resource might expose an attribute called ProxyURL from which a class loader can retrieve the proxy object.