Package jade.core
Class Runtime
- java.lang.Object
-
- jade.core.Runtime
-
public class Runtime extends Object
The singleton instance (accessible through theinstance()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()andcreateMainContainer()methods plus the classes included in thejade.wrapperpackage. - Single-container: Only one container can be executed in the
local JVM. This modality is activated by means of the
startUp()andshutDown()methods
IllegalStateExceptionto 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
- Multiple-container: Several containers (belonging to the same
platform) can be executed in the local JVM. This modality is
activated by means of the
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AgentContainercreateAgentContainer(Profile p)Creates a new agent container in the current JVM, providing access through a proxy object.AgentContainercreateMainContainer(Profile p)Creates a new main container in the current JVM, providing access through a proxy object.static StringgetBundleName()static StringgetBundleVendor()static StringgetCopyrightNotice()Return a String with copyright Notice, Name and Version of this version of JADEstatic StringgetDate()static StringgetRevision()TimerDispatchergetTimerDispatcher()static StringgetVersion()static StringgetVersionInfo()Return the version number and date of this JADE Runtime.static Runtimeinstance()This method returns the singleton instance of this class that should be then used to create agent containers.voidinvokeOnTermination(Runnable r)Allows setting aRunnablethat is executed when the last container in this JVM terminates.voidresetTerminators()Reset the list ofRunnableobjects to be executed on JADE terminationvoidsetCloseVM(boolean flag)Causes the local JVM to be closed when the last container in this JVM terminates.voidshutDown()Stops the JADE container running in the Single-container modality.voidstartUp(Profile p)Starts a JADE container in the Single-container modality.
-
-
-
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 thestartUp()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 thestartUp()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 thecreateAgentContainer()orcreateMainContainer()methods.
-
shutDown
public void shutDown()
Stops the JADE container running in the Single-container modality.
-
invokeOnTermination
public void invokeOnTermination(Runnable r)
Allows setting aRunnablethat is executed when the last container in this JVM terminates.
-
resetTerminators
public void resetTerminators()
Reset the list ofRunnableobjects to be executed on JADE termination- See Also:
invokeOnTermination()
-
getTimerDispatcher
public TimerDispatcher getTimerDispatcher()
-
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()
-
getBundleName
public static String getBundleName()
-
getBundleVendor
public static String getBundleVendor()
-
-