jade.core
Class Runtime

java.lang.Object
  |
  +--jade.core.Runtime

public class Runtime
extends java.lang.Object

The singleton instance (accessible through the instance() static method) of this class allows controlling the JADE runtime system from an external application. Two different modalities of controlling the JADE runtime system exist:

Once a modality has been activated (by calling one of the above methods) calling one of the methods for the other modality cause an IllegalStateException to be thrown.

It should be noted that the Single-container modality only provides a limited control of the JADE runtime system (e.g. it does not allow creating and killing agents), but is the only one supported both in J2SE, PersonalJava and MIDP when using the LEAP add-on.

Author:
Giovanni Rimassa - Universita' di Parma, Giovanni Caire - TILAB

Method Summary
 AgentContainer createAgentContainer(Profile p)
          Creates a new agent container in the current JVM, providing access through a proxy object.
 MainContainer createMainContainer(Profile p)
          Creates a new main container in the current JVM, providing access through a proxy object.
static Runtime instance()
          This method returns the singleton instance of this class that should be then used to create agent containers.
 void invokeOnTermination(java.lang.Runnable r)
          Allows setting a Runnable that is executed when the last container in this JVM terminates.
 void setCloseVM(boolean flag)
          Causes the local JVM to be closed when the last container in this JVM terminates.
 void shutDown()
          Stops the JADE container running in the Single-container modality.
 void startUp(Profile p)
          Starts a JADE container in the Single-container modality.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static Runtime instance()
This method returns the singleton instance of this class that should be then used to create agent containers.


createAgentContainer

public AgentContainer createAgentContainer(Profile p)
Creates a new agent container in the current JVM, providing access through a proxy object.
NOT available in MIDP

Parameters:
p - the profile containing boostrap and configuration data for this container
Returns:
A proxy object, through which services can be requested from the real JADE container.
Throws:
java.lang.IllegalStateException - if the Single-container modality was previously activated by calling the startUp() method.

createMainContainer

public MainContainer createMainContainer(Profile p)
Creates a new main container in the current JVM, providing access through a proxy object.
NOT available in MIDP

Parameters:
p - the profile containing boostrap and configuration data for this container
Returns:
A proxy object, through which services can be requested from the real JADE main container.
Throws:
java.lang.IllegalStateException - if the Single-container modality was previously activated by calling the startUp() method.

setCloseVM

public void setCloseVM(boolean flag)
Causes the local JVM to be closed when the last container in this JVM terminates.
NOT available in MIDP


startUp

public void startUp(Profile p)
Starts a JADE container in the Single-container modality. Successive calls to this method will take no effect.

Parameters:
p - the profile containing boostrap and configuration data for this container
Throws:
java.lang.IllegalStateException - if the Multiple-container modality was previously activated by calling the createAgentContainer() or createMainContainer() methods.

shutDown

public void shutDown()
Stops the JADE container running in the Single-container modality.


invokeOnTermination

public void invokeOnTermination(java.lang.Runnable r)
Allows setting a Runnable that is executed when the last container in this JVM terminates.



JADE