System, Nodes, and Processes in the JADE Database

A JADE system consists of the database and the collections of nodes and processes that go to make up the system. There is one System object for each JADE system. You can reference the System object, by using the reserved word system.

A persistent Node object in the JADE database represents each node in a running JADE system. JADE automatically maintains these node objects. An application process can directly access its own node object through the use of the JADE reserved word node.

Each process running in a JADE system is represented by a persistent Process object in the database. The Process object is created automatically by JADE when the application process starts, and is destroyed when the application process terminates.

An application process can directly access its own process object through the use of the JADE reserved word process.

The System::nodes property returns a reference to a collection of all nodes in a JADE system. The Node::processes property returns a reference to a collection of all processes running on the node.

If you want to know whether any node is executing a specific application, you could write a method like that shown in the following example.

findApp(appName: String): Boolean serverExecution; //more efficient on server
vars
    allNodes: NodeDict;
    allProcesses: ProcessDict;
    nod: Node;
    proc: Process;
begin
    allNodes := system.nodes.cloneSelf(true);
    foreach nod in allNodes do
        allProcesses := nod.processes.cloneSelf(true);
        foreach proc in allProcesses do
            if proc.persistentApp.name = appName then
                return true;
            endif;
        endforeach;
        delete allProcesses;
    endforeach;
    return false;
epilog
    delete allNodes;
    delete allProcesses;
end;

It is important not to use system.nodes and node.processes directly with the foreach statements, because that causes them to be locked. These two collections are updated whenever nodes and processes start up or terminate, so locking them could disrupt system accessibility.

In actual use, the method in the previous example should arm an exception handler, to protect against the possibility of a node or process terminating while the code is executing.