Previous Next Contents Index


15


Cascading Agent Service

Cascading agents enable you to use Java Dynamic Management Kit to implement a hierarchy of master agents and subagents. In a set of cascading agents, the m-beans in a subagent are mirrored in its master agent. The master agent hides the physical location of subagents and provides client applications with a centralized access point. A cascading agent allows the m-beans in one subagent framework to access the m-beans in a different subagent's framework. The domain part of object names must be chosen to avoid naming space conflict.

The cascading agent service can be implemented using the following adaptors:

FIGURE 15-1 shows a master agent and two subagents. In this example, the cascading service is inactive. The master agent can access the objects instantiated in both subagents but the subagents are invisible to each other.

FIGURE  15-1 Cascading Service Inactive
FIGURE 15-2 shows the same agents, but in this example, the cascading service is active. The master agent can still access the objects instantiated in both subagents. Both subagents are now able to access the other subagent's objects.

FIGURE  15-2 Cascading Service Active
A master agent must contain one remote agent for each subagent it communicates with. A remote agent uses the adaptor client API to communicate with a subagent. A remote agent is an instance of the com.sun.jaw.impl.agent.services.cascading.RemoteAgent Java class. CODE EXAMPLE 15-1 shows how to instantiate and activate a remote agent within a master agent using the RMI protocol.    

CODE  EXAMPLE  15-1     Instantiating a Remote Agent

 String host = InetAddress.getLocalHost().getHostName();
 String port = "1099";
 String protocol = "rmi";
 RemoteAgent ra = (RemoteAgent)    cmf.newObject("com.sun.jaw.impl.agent.services.cascading.RemoteAgent",
            cmf.getDomain() +
            "com.sun.jaw.impl.agent.services.cascading.RemoteAgentMO" +
            ".host=" + host +
            ",port=" + port +
            ",protocol=" + protocol);
 ra.setActive(new Boolean(true));  // Activates the cascading agent service


When using the cascading agent service with RMI adaptors, you must run the rmiregistry command for each additional RMI adaptor on the master agent machine, specifying the port number that the additional adaptor will use:


% rmiregistry portNumber

You must also run the rmiregistry command on the master agent machine if the subagent does not use the default RMI port number (1099). In this case, specify the port number that the subagent is using.



Copyright 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303 U.S.A.
Copyright in French

Previous Next Contents Index