copyright The Portico Project 2008.

org.portico.binding.jvm
Class JVMServerConnection

java.lang.Object
  extended by org.portico.core.RTIConnection
      extended by org.portico.binding.jvm.JVMServerConnection

public class JVMServerConnection
extends RTIConnection

This is the JVM-binding RTIConnection implementation that provides a link back to a specific federate so that the RTI can contact it for callbacks.

This class acts much like a unix pipe. If effectively attaches its outgoing channel to the incoming channel of its associated JVMClientConnection. On the other side, the same thing happens, and outgoing messages for the client connection are routed to the incoming message handler of this class (see RTIConnection.receiveRequest(MessageContext)).


Field Summary
private  JVMClientConnection client
           
 
Fields inherited from class org.portico.core.RTIConnection
rti
 
Constructor Summary
JVMServerConnection(JVMClientConnection client)
          Creates a new JVMServerConnection that is associated with a specific client through the given JVMClientConnection.
 
Method Summary
 void close(String reason)
          Called when the connection should close (for whatever reason).
 void sendCallback(com.lbf.commons.messaging.MessageContext context)
          Passes the given message over to the linked JVMClientConnection where it is given to the LRC for processing.
 
Methods inherited from class org.portico.core.RTIConnection
getRtiExecution, harvestConnection, receiveRequest, setRequestHandler, setRtiExecution
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

client

private JVMClientConnection client
Constructor Detail

JVMServerConnection

public JVMServerConnection(JVMClientConnection client)
                    throws JException
Creates a new JVMServerConnection that is associated with a specific client through the given JVMClientConnection. Through the client connection, the federate can be contacted.

Throws:
JException
Method Detail

sendCallback

public void sendCallback(com.lbf.commons.messaging.MessageContext context)
                  throws Exception
Passes the given message over to the linked JVMClientConnection where it is given to the LRC for processing. If an error occurs, an exception response is packaged into the context and processing ends.

Specified by:
sendCallback in class RTIConnection
Throws:
Exception

close

public void close(String reason)
Called when the connection should close (for whatever reason). This method will break any connection between this instance and the associated JVMClientConnection by first setting any of its references to this instance to null, and then setting local references to the client to null.

Specified by:
close in class RTIConnection
Parameters:
reason - Textual description of why the connection is being closed. Note that this may be null, so be sure to check before using it

copyright The Portico Project 2008.