Getting Started with the Java Dynamic Management Kit 4.1

JMX MBean Notification Model

The management interface of an MBean allows an MBean's agent to perform control and configuration operations on the managed resources. The JMX MBean notification model allows MBeans to broadcast management notifications. Management applications and other objects register as listeners with the broadcaster MBean. The JMX MBean notification model enables a listener to register only once and still receive all different notifications that may occur in the broadcast.

Adding a local Notification Listener at the agent side

If you want to add a Notifcation Listener at the agent side, you need to call the addNotificationListener method on the MBean server. The MBean server calls the addNotificationListener on the MBean. This is illustrated in Figure 1-2.

Figure 1-2 Adding local listeners at the agent side

Graphic

Adding remote Notification Listener at the manager side

You can also add a Notification Listener, addNotificationListener remotely, on the manager side. You can add a notification listener on a proxy MBean, as illustrated in Figure 1-3.

To add a listener to the manager side, call the appropriate addNotificationListener operation from proxy MBean A. This will transmit a call to the agent side and a local listener will be created internally to represent the remote listener (internal listener 1 in Figure 1-3). This local listener will then be created in the MBean server. This local listener in turn will receive and forward all notifications to the remote, internal listener. This is a protocol-dependent listener and is handled by the connector server. It is in charge of sending notifications throughout the network, from the agent side to the manager side.

Figure 1-3 Adding remote listeners at the manager side 1

Graphic

You can also add a listener to the manager side directly, through the interface of the connector client. To do this, call the addNotificationListener operation from the connector client interface.

Figure 1-4 Adding remote listeners at the manager side 2

Graphic

Remote Notification Mechanism

The ClientNotificationHandler public interface specifies the methods for a connector to allow a notification listener to receive notifications from a remote MBean in an agent. The ClientNotificationHandler interface is implemented by HTTP and RMI connector clients at the manager side. To forward a notification from the agent to the connector client you can configure the connector to use either push or pull mode. In pull mode, the connector server on the agent side buffers all notifications until the connector client requests, or pulls, them. The forwarding period can be set to control the frequency with which notifications are pulled from the connector server. In push mode, the connector server forwards every notification to the connector client as it is received. In the Java Dynamic Management Kit 4.1 the forwarding period is not used in push mode, notifications are forwarded immediately. Figure 1-5 illustrates this process in terms of the Pull mechanism and the Push mechanism.

The Push Mechanism

You can choose to use the Push Mechanism to push notifications from an agent to a manager. When the connectors run the Push Mechanism , the connector server forwards the notifications to the connector client as soon as they are emitted by the MBeans. For example, you can register an object at the manager side as a listener for notifications emitted by MBean A. Thus, when MBean A, at the agent side, emits a notification, the HTTP, HTTP/SSL or RMI connector forwards this notification to the connector client at the manager side.

The Pull Mechanism

You can choose to use the Pull Mechanism to forward notifications from an agent to a manager. This is useful, for instance, when the agent is unable to connect to a manager. For example, if there is a fire-wall in place between the agent side and the manager side. You can use the Pull Mechanism to pull notifications from the agent side to the manager side. When you create the remote MBean server you need to set the mechanism mode and the pull period. The pull period is the time period between pulls. Pulls occur when the HTTP, HTTP/SSL or RMI connector server at the agent side is instructed by the manager to attempt to pull notifications. Thus, the manager decides when, and how often, it wants to retrieve notifications . For example, the pull frequency could be set to try to get notifications every thirty seconds or every minute.

Figure 1-5 Remote Notification Mechanism

Graphic