From JPPF Documentation

Contents

JPPF provides support for forwarding JMX requests to the nodes, along with receiving notifications from them, via the JPPF driver's JMX server.
Which nodes are impacted is determined by a user-provided node selector.

This brings two major benefits:

this allows managing and monitoring the nodes in situations where the nodes are not reachable from the client, for instance when the client and nodes are on different networks or subnets

the requests and notification forwarding mechanism automatically adapts to node connection and disconnection events, which means that if new nodes are started in the grid, they will be automatically enrolled in the forwarding mechanism, provided they match the node selector

Node selectors

All the node forwarding APIs make use of node selectors to conveniently specify which nodes they apply to. A node selector is an instance of the NodeSelector interface, defined as follows:

// Marker interface for selecting nodes
public interface NodeSelector extends Serializable {
// Constant for a selector which accepts all nodes
NodeSelector ALL_NODES = new AllNodesSelector();
// Selects all nodes
public final static class AllNodesSelector implements NodeSelector {
// Default constructor
public AllNodesSelector()
}
// Selects nodes based on an execution policy
public final static class ExecutionPolicySelector implements NodeSelector {
// Initialize this selector with an execution policy
public ExecutionPolicySelector(final ExecutionPolicy policy)
// Get the execution policy to use to select the nodes
public ExecutionPolicy getPolicy()
}
// Selects nodes based on their uuids
public final static class UuidSelector implements NodeSelector {
// Initialize this selector with a collection of node UUIDs
public UuidSelector(final Collection<String> uuids)
// Initialize this selector with an array of node UUIDs
public UuidSelector(final String...uuids)
// Get the collection of uuids of the nodes to select
public Collection<String> getUuidList()
}
}

Note that the node selection dynamically adjusts to the JPPF grid topology, or in other words two distinct selections with the same selector instance may return a different set of nodes: when new nodes are added to the grid or existing nodes are terminated, these changes in the toplogy will be automatically taken into account by the selection mechanism.

Forwarding management requests

The request forwarding mechanism is based on a built-in driver MBean: JPPFNodeForwardingMBean, which provides methods to invoke methods, or get or set attributes on remote node MBeans.
Each of its methods requires a NodeSelector argument and an MBean name, to determine to which nodes, and which MBean in these nodes, the request will be performed.
The return value is always a map of node UUIDs to the corresponding value returned by the request (if any) to the corresponding node.
If an exception is raised when performing the request on a specific node, then that exception is returned in the map.

Forwarding JMX notifications

JPPF provides a way to subscribe to notifications from a set of selected nodes, which differs from the one specified in the JMX API.
This is due to the fact that the server-side mechanism for the registration of notification listeners is unspecified and thus provides no reliable way to override it.

To circumvent this difficulty, the registration of the notification listener is performed via the JMX client wrapper JMXDriverConnectionWrapper:

The notifications forwarded from the nodes are all wrapped into instances of JPPFNodeForwardingNotification.
This class, which inherits from Notification, provides additional APIs to identify from which node and which MBean the notification was emitted.