The Bond agents are able to perform inference by using the JESS inference engine. The class, bondInferenceEngine, is a Bond object that wraps the JESS inference engine and provides interfaces to access the inference engine.
The Bond agent framework provides bondInferenceStrategy and bondInferenceGuiStrategy that allow agents to access the JESS inference engine, which is stored in the model of the agents. The inference engine are provided with a set of rules and facts. The rules consist of conditions and action. The action is executed when the specified conditions are matched. The conditions are matched when the facts that are specified in the conditions are present.
The example agents that use the inference capability is
Tuplespace enables the agents to perform those communications; it is a shared dataspace for the agents to write, read, and retrieve tuples that are ordered sets of typed fields. The integration of the tuplespace brings similar challenges to those of the above integration of inference engines.
The Bond agents can use the tuplespace service, which is implemented
in bondTupleSpace. The bondTupleSpace
is a Bond object that wraps the tuplespace implementation of IBM,
TSpaces, which provides a fault-tolerant and transaction-based access
tuplespace.
The tuplespace service can be started from the GUI of the resident.
There are strategies that provides the interface to access the tuplespace service: bondTupleSpaceEnabledStrategy and bondTupleSpaceEnabledGuiStrategy. They are used as the base classes from which other classes requiring the tuplespace service access can be extended. Some of the interfaces provided by the above classes are as follows:
The above interfaces requires the name of the machine on which the
tuplespace service is running and the name of the subspace to which the
action is targeted. These specification can be avoided by set up the default
machine name and the subspace name by using the interface,
setTupleSpace(String host, String sname).
The barrier is used to synchronize a set of agents that involve in a task. The barrier originates as a logical point in parallel programs at which all participating processors are synchronized to start and end their executions.A master--worker barrier synchronization through a shared space was implemented. The barrier is implemented as a tuple in a tuplespace.
The barriers have names that identify and distinguish themselves from other barriers. In the beginning, a master agent creates a barrier to the shared space. The barrier has an associated goal number, the number of tokens that this barrier must collect before notifying the master agent of the completion of all worker agents. Then, the master agent signals a set of worker agents to proceed by sending messages, which also include the barrier name. Upon completion of their tasks, the worker agents post tokens to the barrier, which in turn increase the barrier's internal variable, current token number, incrementally.The example agent-based system to use the barrier is an agent-based Web benchmarking system.
The agent factory, which assembles agents as directed by the blueprint, can download strategies that are required to assemble the agents from remote places, e.g., strategy repository. The agent factory searches for the strategies from the three places in the following order: first, local disk, a specified strategy repository, and finally a default strategy repository. The request for agent creation can contain the parameter that specifies the strategy repository from which required strategies can be downloaded.The implementation can be found in bondLoader. A part of bondLoader that is related to remote strategy loading is as follows:
public Class loadClass(String name, Vector searchpaths) {
String completename;/*
search for strategies in local disk
*/for(int i=0; i!=searchpaths.size(); i++) {
try {
Class cl = Class.forName(makeName(name, (String)searchpaths.elementAt(i)));
/*
if a required strategy is found, return.
*/
return cl;
} catch(ClassNotFoundException cnfe) {
} catch(Exception ex) {
Log.Debug("Some exception:");
ex.printStackTrace();
}
}/*
If the execution flow reaches this point, the strategy is not available locally.
Load classes remotely
*/if (cloader == null) {
/*
the location of the strategy repository specified in the agent creation request message.
*/
String c_repository = System.getProperty("bond.current.strategy.repository");
/*
the location of the default strategy repository
*/
String repository = System.getProperty("bond.strategy.repository");
if (c_repository != null && repository != null) {
try {
URL urlList[] = {new URL(c_repository), new URL(repository)};
cloader = new URLClassLoader(urlList);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
}
else if (repository != null) {
try {
URL urlList[] = {new URL (repository)};
cloader = new URLClassLoader(urlList);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
}
The Bond agents form a federation, which refer to a set of agents that collaborate a task, and monitor the fault of other agents in distributed way and allows new/repaired agents to join the federation any time. The agents should monitor only one agent and be monitored by only one agent, thus the agents in a federation form a ring monitoring topology if the monitoring relations among the agents are represented as directed graph. The agents detects either the fault of the agent or the join of new/repaired agent. Once such information is detected, the agent starts to disseminate the information to other agents. The agents involving in disseminating the information form a binary tree.
The detail about the algorithms can be found in the paper.
The algorithms were implemented by the following classes that are availabe in Bond/bond/agent/FaultDetection:
- bond.agent.FaultDetection.bondFaultDetectionExecutable: The base class of all executable classes for the fault detection and information dissemination.
- bond.agent.FaultDetection.bondFaultDetectionMH: it handles all incoming messages and dispatches them to proper handler.
- bond.agent.FaultDetection.bondFaultDisseminator: it starts to disseminate the events that are detected.
- bond.agent.FaultDetection.bondFaultInfoHandler: it handles incoming messages that contain event information.
- bond.agent.FaultDetection.bondFaultMonitor: it performs a peridic monitoring by sending messages to the one being monitoring.
- bond.agent.FaultDetection.bondFaultMonitorSearcher: it requests other agents to monitor "me".
- bond.agent.FaultDetection.bondFaultStatus: the fault status table.
The execution of the algorithm is controlled by whether the agent control message "start-agent" contains a parameter ":alias" or not. If the parameter ":alias" is provided and a configuration parameter, bond.faultDetection, as true in the file, properties of which location is Bond/bond/core/, the agents are configured to embed the implementation of the above algorithms. The following is a part of sphAgentControl() method of bondAgent.java.if (m.content.equals("start-agent")) {
String als = (String)m.getParameter(":alias");
if (als != null) {
dir.addAlias(als, this);
initFaultDetection();
}
start();
return;
}where String als should be non-null and has an agent ID in order to run the algorithms by calling the method initFaultDetection(), which in turn,
public void initFaultDetection() {
String tmp;
if ( (tmp = System.getProperty("bond.faultDetection")) != null && tmp.equals("true")) {
fs = new bondFaultStatus(dir.getAlias(this)+"+"+com.localaddress+":"+com.localport);
fs.startFaultDetectionMessageHandler();
// load system graph
fs.initStatusTable(System.getProperty("default.monitoring.agent"));
// start searching
fs.startMonitorSearcher(true);
}
}where it first create a fault status table and start to run the algorithms. The agent ID that is given as the value of the parameter ":alias" should be non-negative integer. It should be cautious not to assign the same ID to multiple agents.