Getting Started with the Java Dynamic Management Kit 4.2

Connectors

Connectors establish a point-to-point connection between an agent and a management application, each running in a separate Java VM. The Java Dynamic Management Kit provides connectors for the HTTP/TCP, HTTP/SSL and RMI protocols. Every connector provides the same remote API, which frees management applications from any protocol dependency.

A connector is composed of two parts:

Therefore, a Java application which instantiates a connector client may perform all management operations which are available through the agent's MBean server.

In the client-server model, it is the connector client which initiates all connections and all management request. An agent is identified by an address which contains the agent's hostname and port number. The target agent must contain an active connector server for the desired protocol. The address object is protocol-specific, and may contain additional information needed for a given protocol.

The connector client uses this address to establish a connection with its corresponding connector server. A connector client can only establish one connection at a time. This implies that a manager instantiates one connector client for each agent it wishes to contact. The management application must wait for the connector to be online, meaning that a connection is established and ready to send requests.

Management applications can then invoke one of the methods of the connector client to issue a request. These methods have parameters which define the object name of the MBean and the attribute or operation name to which the request applies. If the request has a response it will be returned to the caller.

A connector hides all the details of the protocol encoding from the Java applications. Agent and manger exchange management requests and responses based on the JMX architecture. The underlying encoding is hidden and not accessible to the applications.

Connector Heartbeat

All connectors provided in the Java Dynamic Management Kit implement a heartbeat mechanism. The heartbeat allows both the agent and manager applications to detect when a connection is lost, either because the communication channel is interrupted or because one of the applications has been stopped.

The connector client and connector server components exchange heartbeat messages periodically. When a heartbeat is not returned, or an expected heartbeat is not received, both components begin a retry and timeout period. If the connection is not reestablished, both the connector client and the connector server will free the resources allocated for that connection.

The heartbeat mechanism is only configurable on the manager side, the connector server simply replies to heartbeats. The manager application can set the retry policy as determined by the heartbeat period and the number of retries. The manager application may also register for heartbeat notifications which are sent whenever a connection is established, retrying, reestablished, lost, or terminated.

Proxy MBeans

A proxy MBean is an object which represents a specific MBean instance and makes it easier to access that MBean. A management application instantiates a proxy so that it has a simple handle on a registered MBean, instead of needing to access the MBean server.

The manager may access MBeans by invoking the methods of their proxy object. The proxy formulates the corresponding management request to the MBean server. The operations are those which are possible on an MBean:

Because dynamic MBeans only expose their management interface at runtime, they cannot have a specific proxy MBean. Instead they have a generic proxy whose methods have an extra parameter to specify the attribute or operation name. The following diagram shows management components interacting with both standard and dynamic MBeans through both standard and generic proxies. Notice that a generic proxy may also represent a standard MBean.

Figure 2-1 Binding Proxy MBeans to Local and Remote Servers

Graphic

This diagram also shows that proxies may be instantiated either locally in the agent or remotely in the manager. Since the MBean server and the connector client have the same API, management request to either of them are identical. This creates a symmetry that allows the same management components to be instantiated either in the agent or in the manager application. This feature contributes to the scalability of Java Dynamic Management applications.

A standard proxy is generated from a standard MBean by using the proxygen compiler, supplied with the Java Dynamic Management Kit. The resulting class then needs to be loaded wherever the proxy will be instantiated. Generic proxies provide less of an abstraction but do not need to be generated. They are part of the Java Dynamic Management Kit libraries and are thus always available.