Package jade.core

Class Runtime


  • public class Runtime
    extends 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:
    • Multiple-container: Several containers (belonging to the same platform) can be executed in the local JVM. This modality is activated by means of the createAgentContainer() and createMainContainer() methods plus the classes included in the jade.wrapper package.
    • Single-container: Only one container can be executed in the local JVM. This modality is activated by means of the startUp() and shutDown() methods
    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, PJAVA/CDC and MIDP when using the LEAP add-on.

    Author:
    Giovanni Rimassa - Universita' di Parma, Giovanni Caire - TILAB
    • 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:
        IllegalStateException - if the Single-container modality was previously activated by calling the startUp() method.
      • createMainContainer

        public AgentContainer 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:
        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:
        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​(Runnable r)
        Allows setting a Runnable that is executed when the last container in this JVM terminates.
      • resetTerminators

        public void resetTerminators()
        Reset the list of Runnable objects to be executed on JADE termination
        See Also:
        invokeOnTermination()
      • getCopyrightNotice

        public static String getCopyrightNotice()
        Return a String with copyright Notice, Name and Version of this version of JADE
      • getVersionInfo

        public static String getVersionInfo()
        Return the version number and date of this JADE Runtime.
      • getVersion

        public static String getVersion()
      • getRevision

        public static String getRevision()
      • getDate

        public static String getDate()