Author: Giovanni Rimassa (Università di Parma)
Since Jade 2.3, an in- process interface has been implemented that allows Java application to use JADE as a kind of library. This example, in particular, shows how to start a JADE runtime from an external application. The implemented mechanism is very valuable and allows several different configurations for a JADE platform, such as a complete in-process platform composed of several containers on the same JVM, an hybrid platform partly in-process (containers launched by an external Java application) and partly out-of-process (containers launched from the command line).
The two following examples list the commands to issue in order to create two sample hybrid platforms
Example 1: In-process main container and out-of-process additional container.
a) java examples.inprocess.InProcessTest (one main container and an additional one)
b) java jade.Boot -container -port 8888 (an out-of-process container, connecting to the in-process platform).
Example 2: Out-of-process main container and in-process additional containers.
a) java jade.Boot -gui (on out-of-process main container, listening on port 1099)
b) java examples.inprocess.InProcessTest -container (an in-process container, connecting to the out-of-process platform).
|The InProcessTest class is not a JADE agent, but has its own main() method instead. When started, the example launches a JADE main container on the local host, on port 8888, and a peripheral container, both within the same JVM. An RMA agent is also started.(example1).If the ‘-container’ option is given, then two non-main container that are started try to connect to an external main container that must be already active on the local host, port 1099. Then the platform starts and kills a DummyAgent and finally it starts the MobileAgent example (example2). Using this example and the regular jade.Boot loader, hybrid platforms (i.e. platform that live partly in-process and out-of-process) can be deployed|
|Jade classes used:|
|Runtime, Profile, package jade.wrapper|