copyright The Portico Project 2008.

org.portico.binding.jvm
Class JVMBootstrap

java.lang.Object
  extended by com.lbf.commons.component.AbstractComponent
      extended by org.portico.core.Bootstrap
          extended by org.portico.binding.jvm.JVMBootstrap
All Implemented Interfaces:
com.lbf.commons.component.IComponent

public class JVMBootstrap
extends Bootstrap

The JVMBootstrap class acts as a something of a singleton through which an federate that is running in a separate thread can access the RTI. When an RTIExec starts up, it notifies all of the bootstraps that it contains. The RTIExec will call the Bootstrap.execute() method on the Bootstrap subclasses to perform this. When the JVMBootstrap class sees the execute method, it will assign itself to the shared static variable INSTANCE.

If there is not a running RTIExec (or none of those that are running contain the JVM bootstrap), the instance will remain null and JVM binding federates will not be able to contact the RTI. Only once an RTIExec that is configured with the JVM bootstrap has been started will access be possible.

Starting Multiple RTIs

WARNING: If multiple RTIs are started, they may each overwrite one-another in the static INSTANCE variable. That static variable will contain a link to the *last* RTIExec that started up. However, if there was some time between the startups, there may be some federates with links to the older RTIExec, and as such, they won't be able to talk to federates in the new one (as it is a different execution). This only happens when someone is trying to run multiple RTIExec's in the same JVM. It is wise to avoid this situation and just run a single RTIExec.


Field Summary
protected static JVMBootstrap INSTANCE
          The shared JVMBoostrap.
 
Fields inherited from class org.portico.core.Bootstrap
bootstrapHandler, CONFIG_HANDLER, CONFIG_RTIEXEC, execution, logger
 
Fields inherited from class com.lbf.commons.component.AbstractComponent
executing, name, shutdown
 
Constructor Summary
JVMBootstrap()
           
 
Method Summary
 void cleanup()
          Set the INSTANCE variable to null, thus removing the ability of any jvm federates to access the RTI.
 com.lbf.commons.messaging.IMessageHandler getBootstrapHandler()
          Get the bootstrap message handler.
 void startBootstrap()
          Puts this bootstrap in the static INSTANCE variable within this class.
 void stopBootstrap()
          This method is empty in JVMBootstrap
 
Methods inherited from class org.portico.core.Bootstrap
configure, configureBootstrap, execute, federationCreated, federationDestroyed, getExecution, getLogger, shutdown
 
Methods inherited from class com.lbf.commons.component.AbstractComponent
getName, isExecuting, isShutdown, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

protected static JVMBootstrap INSTANCE
The shared JVMBoostrap. Clients use this to access the RTIExec

Constructor Detail

JVMBootstrap

public JVMBootstrap()
Method Detail

cleanup

public void cleanup()
             throws com.lbf.commons.component.ComponentException
Set the INSTANCE variable to null, thus removing the ability of any jvm federates to access the RTI. Actual cleanup of the RTI is left to it.

Specified by:
cleanup in interface com.lbf.commons.component.IComponent
Overrides:
cleanup in class com.lbf.commons.component.AbstractComponent
Throws:
com.lbf.commons.component.ComponentException

startBootstrap

public void startBootstrap()
                    throws com.lbf.commons.component.ComponentException
Puts this bootstrap in the static INSTANCE variable within this class. This method is called when the bootstrap is being told by the RTI to start up.

Specified by:
startBootstrap in class Bootstrap
Throws:
com.lbf.commons.component.ComponentException

stopBootstrap

public void stopBootstrap()
This method is empty in JVMBootstrap

Specified by:
stopBootstrap in class Bootstrap

getBootstrapHandler

public com.lbf.commons.messaging.IMessageHandler getBootstrapHandler()
Get the bootstrap message handler. This should be the target of the big-three request messages (create,destroy,join).

Overrides:
getBootstrapHandler in class Bootstrap

copyright The Portico Project 2008.