copyright The Portico Project 2008.

org.portico.binding.jsop.rti
Class JSOPBootstrap

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

public class JSOPBootstrap
extends Bootstrap

This class is responsible for managing the lifecycle of the JSOPDaemon. When this bootstrap is told to start up (when an RTI execution starts) it will start a JSOPDaemon in a new thread. When the bootstrap is told to shutdown (usually when the RTI shuts down), it will kill the thread and daemon.


Field Summary
private  boolean active
           
private  JSOPDaemon daemon
           
private  Thread daemonThread
           
private  int jsopPort
           
private static String KEY_PORT
           
 
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
JSOPBootstrap()
           
 
Method Summary
 void configureBootstrap(com.lbf.commons.utils.Bag<String,?> properties)
          Looks in the given properties for the port on which the JSOPDaemon should listen for incoming JSOP connections.
 JSOPDaemon getDaemon()
           
 void startBootstrap()
          This will start a new JSOPDaemon.
 void stopBootstrap()
          This method is called when it is time for the Bootstrap to shutdown.
 
Methods inherited from class org.portico.core.Bootstrap
configure, execute, federationCreated, federationDestroyed, getBootstrapHandler, getExecution, getLogger, shutdown
 
Methods inherited from class com.lbf.commons.component.AbstractComponent
cleanup, getName, isExecuting, isShutdown, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_PORT

private static final String KEY_PORT
See Also:
Constant Field Values

daemon

private JSOPDaemon daemon

daemonThread

private Thread daemonThread

jsopPort

private int jsopPort

active

private boolean active
Constructor Detail

JSOPBootstrap

public JSOPBootstrap()
Method Detail

configureBootstrap

public void configureBootstrap(com.lbf.commons.utils.Bag<String,?> properties)
                        throws com.lbf.commons.config.ConfigurationException
Looks in the given properties for the port on which the JSOPDaemon should listen for incoming JSOP connections. If the properties don't contain the property with the key identified in KEY_PORT, the default will be used (as stored in the JSOPConstants.DEFAULT_PORT.

Overrides:
configureBootstrap in class Bootstrap
Throws:
com.lbf.commons.config.ConfigurationException

startBootstrap

public void startBootstrap()
                    throws com.lbf.commons.component.ComponentException
This will start a new JSOPDaemon. It will first register the connection with the MulticastRegistry so that it can be automatically discovered by clients. Then a new JSOPDaemon will be started.

Multicast Registration Failure

If another RTI exists and contains a running JSOPDaemon (be it in the same JVM or a separate one), the registration to the MulticastRegistry will fail. This error will be logged, however, it will *NOT* prevent the bootstrap from starting. The RTI will still be available for JSOP connections, it just won't be discoverable.

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

stopBootstrap

public void stopBootstrap()
                   throws com.lbf.commons.component.ComponentException
This method is called when it is time for the Bootstrap to shutdown. It will remove the connection from the MulticastRegistry so that it can no longer be discovered. After this, it will instruct the JSOPDaemon to shutdown through the JSOPDaemon.shutdown() method. This method wil join the daemon thread, waiting for it to exit (thus signalling that the daemon has shut down).

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

getDaemon

public JSOPDaemon getDaemon()

copyright The Portico Project 2008.