|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.portico.core.fedex.Federation
public class Federation
The main representation of a federation within Portico. This class groups together all the relevant components used to provide the federation features. These components are described below.
Messaging and Behaviour TheFederation
uses a group of MessageSink
s (see the littlebluefrog labs commons
project). The Federation
class contains all the messaging related components used to
process requests from federates and do the general business of the RTI. Requests are processed
in three separate "zones":
Callback Processor
: The callback-processor
extracts messages that were placed on the callback-queue and sends them to the appropriate
federate. The processor enacpsulates a number of threads to perform this task.RTIConnection.receiveRequest(MessageContext)
method is the
thread that is used to execute request-sink processing. For example, in the JSOP bindings, the
thread that is servicing a particular socket for a federate-RTI connection is the one that is
used. In the JVM bindings, it is the same thread that invokes the RTIambassador. The source
of the thread cannot be determined, but many can be running request-sink processing calls
at the same time.CallbackQueueProcessor
manages this process. It
encapsulates a number of threads that extract messages from the callback-queue and perform
the actual callback (which may involve expensive I/O).
ActionQueueProcessor
, which then passes them
to the action-sink.CallbackQueueProcessor
then extract the messages from here and actually
send the callback.
FederationState
object. This includes
all the various state-management/altering entities (such as the SyncPointManager
and
TimeManager
). This data is shared between a large number of potential threads, and as
such, locking is necessary. Many of the management entities already perform this locking where
necessary on behalf of a user. See the javadoc for each component for specific information.
MOM Data
Two entities relating to the MOM are stored in the Federation
. The first is an instance
of the MomManager
that handles all MOM-related requests. The second is a specially
created instance of the Federate
class that is to represent the actual Mom federate.
This is used to interact with incoming HLA-requests at the actual HLA level, and as such, it
behaves just like a regular federate with a minor exception. The MOM federate isn't stored in
the same place as the other federates that have joined the federation. Rather, this store is
kept to be only user created federates. The MOM-federate shouldn't have any bearing on things
such as determining whether or not a federation can be destoyed or not (there should be no
federates left), and as such, it is kept separate from the other federates.
See the javadoc for the MomManager
for more information on MOM behaviour.
Nested Class Summary | |
---|---|
private class |
Federation.DefaultRequestHandler
The default handler for messages sent to the request-sink. |
Field Summary | |
---|---|
private ActionQueueProcessor |
actionProcessor
|
private BlockingQueue<com.lbf.commons.messaging.RequestMessage> |
actionQueue
|
private com.lbf.commons.messaging.MessageSink |
actionSink
|
private Thread |
actionThread
|
private CallbackQueueProcessor |
callbackProcessor
|
private BlockingQueue<FED_CallbackMessage> |
callbackQueue
|
private HashMap<String,Federate> |
federates
|
static String |
KEY_FEDERATION
|
private org.apache.log4j.Logger |
logger
|
private Federate |
momFederate
|
private MomManager |
momManager
|
private String |
name
|
private com.lbf.commons.messaging.MessageSink |
requestSink
|
private RTIExec |
rti
|
private boolean |
running
|
private FederationState |
state
|
Constructor Summary | |
---|---|
Federation(RTIExec rti,
String name,
ObjectModel model)
Create a new federation for the given object model (the model is then passed on to the FederationState where it is stored). |
Method Summary | |
---|---|
boolean |
containsFederate(String name)
Does this federation contain a federate by the given name? |
int |
federateCount()
Get a count of the number of joined federates (excludes the mom federate) |
BlockingQueue<com.lbf.commons.messaging.RequestMessage> |
getActionQueue()
|
com.lbf.commons.messaging.MessageSink |
getActionSink()
|
Set<Federate> |
getAllFederates()
|
BlockingQueue<FED_CallbackMessage> |
getCallbackQueue()
|
Federate |
getFederate(int handle)
Get the joined federate of the given handle. |
Federate |
getFederate(String name)
Get the joined federate of the given name. |
org.apache.log4j.Logger |
getFederationLogger()
|
MomManager |
getMomManager()
|
String |
getName()
|
com.lbf.commons.messaging.MessageSink |
getRequestSink()
|
RTIExec |
getRTIExec()
|
FederationState |
getState()
|
void |
joinFederate(Federate federate)
Try and add the given federate to this federation. |
Federate |
resignFederate(String name)
Remove the joined federate from this federation. |
void |
shutdown()
This method will stop the internal processing threads for this federation. |
void |
startup()
This method will start the internal processing threads for this federation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEY_FEDERATION
private RTIExec rti
private String name
private HashMap<String,Federate> federates
private boolean running
private FederationState state
private MomManager momManager
private Federate momFederate
private com.lbf.commons.messaging.MessageSink requestSink
private com.lbf.commons.messaging.MessageSink actionSink
private BlockingQueue<com.lbf.commons.messaging.RequestMessage> actionQueue
private ActionQueueProcessor actionProcessor
private Thread actionThread
private BlockingQueue<FED_CallbackMessage> callbackQueue
private CallbackQueueProcessor callbackProcessor
private org.apache.log4j.Logger logger
Constructor Detail |
---|
public Federation(RTIExec rti, String name, ObjectModel model) throws JRTIinternalError, JErrorReadingFED
FederationState
where it is stored). After construction, the federation still needs
to be configured and started (none of the internal threads are active following constuction).
Constructors for this class should never be invoked directly.
The FedexFactory
should be used to create federations as it will
ensure that they are propertly setup and configured.
JRTIinternalError
JErrorReadingFED
Method Detail |
---|
public void startup()
public void shutdown()
public int federateCount()
public void joinFederate(Federate federate) throws JFederateAlreadyExecutionMember
federate
- The federation that wants to join this federation
FederateAlreadyExecutionMember
- If there is already a federate with the given name
that has been joined to this federation
JFederateAlreadyExecutionMember
public Federate resignFederate(String name)
name
- The name of the federate to remove
public Federate getFederate(String name)
name
- The name of the federate to get
public Federate getFederate(int handle)
handle
- The handle of the federate to get
public boolean containsFederate(String name)
public Set<Federate> getAllFederates()
public RTIExec getRTIExec()
public String getName()
public com.lbf.commons.messaging.MessageSink getRequestSink()
public com.lbf.commons.messaging.MessageSink getActionSink()
public BlockingQueue<com.lbf.commons.messaging.RequestMessage> getActionQueue()
public BlockingQueue<FED_CallbackMessage> getCallbackQueue()
public FederationState getState()
public org.apache.log4j.Logger getFederationLogger()
public MomManager getMomManager()
|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |