Starting the Runtime


The Lime server embodies the runtime support needed to run applications on a given host. It is possible to run multiple Lime servers on each host, as long as they are started on different ports. This is useful for testing applications where eventually multiple hosts will be used, but during testing the hosts are simulated. The Lime server can be started from within a Java application, or from the command line using the lime.util.Launcher.

If the Lime server is started from within a Java application, it runs as a separate thread within the Java VM that contains the application. Please refer to the API documentation for lime.LimeServer for a description of the methods available on a LimeServer object.

If the Lime server is launched from the command line, it is executed within a separate Java VM. Since the actual computation is performed by agents executing in a Lime server, the problem remains of loading such agents into the Lime server. There are basically two ways to achieve this with the current API:

  1. Load the application agents when the Lime server is created.
    For instance,
    java lime.util.Launcher -load MyAgent1 MyAgent2
  2. Start the Lime server and, separately, load the application agents into it.
    In one shell, type
    java lime.util.Launcher
    This will start the Lime server with no agents running. In another shell, type
    java lime.util.Launcher -quit -load MyAgent1 MyAgent2
    This will load the agents into an already existing Lime server (the one we previously started) and then exit immediately.
Some things are worth noting in the commands above:

Launching Mobile Agents

The text above describe how to launch a server that can contain only stationary, non-mobile agents. However, Lime allows also for mobile agents, and actually an adaptation layer has been developed that in principle allows to use Lime with any mobile agent system. In the current distribution, the only adapter provided supports the µCode mobile agent toolkit. Operation of this system with Lime requires a different launcher, lime.mobileagent.mucode.Launcher, with slightly different command-line options:

Usage: java lime.mobileagent.mucode.Launcher 
                       [--mucode [mucode options]]
                       [--lime [lime options]]
                       [--load [class names of agents to be loaded]]
OR     java lime.mobileagent.mucode.Launcher
                       [--send <host:port of target muserver
                               <class names of agent to be loaded remotely>]
For instance:
java lime.mobileagent.mucode.Launcher --mucode -port 2000 --lime -port 3000 -debug on --load InteractiveMobileAgent
loads InteractiveMobileAgent in a mucode server that listens on port 2000, connected with a Lime server (whose debug messages are enabled) listening on port 3000.
java lime.mobileagent.mucode.Launcher --send localhost:2000 InteractiveMobileAgent InteractiveMobileAgent
loads (remotely) two additional instances of InteractiveMobileAgent in the mucode server previously created and then quits.
After this last command, if the three instances of InteractiveMobileAgent engage their tuple spaces they will all share the same host-level tuple space.
Note:
  1. If specified, the --mucode option must mandatorily come before the --lime option, and the --load option must be last.
  2. The --load option causes the mobile agent to be loaded into the µcode server. The lime option -load instead loads the agent directly in the Lime server.
  3. The --send option performs the remote loading and then quits. 

For additional information about the options available for the µCode server and the system in general, please see the µCode site.