|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmanager.LocalManager
public class LocalManager
This is the primary interface for the distributed executive which is exported to the local model. From a modeller's perspective, the most important function the LocalManager serves are the registration of local objects and the discovery of remote objects registered by other HLA_RePast instances. In addition to these visible functions, the LocalManager coordinates the creation and joining of the federation as well as constrained time-advance and conflict resolution (via ownership-management). Because the LocalManager performs reference tracking by interfacing with the local JVM (to automate object deletion) it is implemented as a singleton class and should only be accessed statically.
Field Summary | |
---|---|
protected Advancer13 |
advancer
The Advancer13 used to manage the time-advance of this manager |
protected manager.CallbackBuffer |
cbDispatcher
The dispatcher is the FederateAmbassador interface provided to the RTI, it filters incoming calls, cloning significant objects and equeing the callbacks in this manager's externQueue |
protected java.lang.Class[] |
classes
The set of classes this federate will be using to represent objects in the simulation (this includes both local and proxy objects). |
protected ClassLookup |
classLookup
A mapping of handles to variable names and vice-versa, is resolved on a simulation-by-simulation basis at the beginning of a fedex. |
protected Coupler |
coupler
The Coupler used to constrain the initialisation of this manager |
protected boolean |
create
Indicates whether this federate tried (or should try) to create the federation execution. |
protected manager.EventQueue |
externQueue
The recipient of all events incoming from the RTI. |
protected java.lang.String |
federateID
The id for this federate |
protected java.lang.String |
federationName
The name of this federate execution |
protected java.lang.String |
fedFile
The full path of the .fed file to use in this federation |
protected java.lang.Class[] |
fedTree
The initial declaration of classes reflected or published by the local simulation |
protected boolean |
isLeader
Indicates whether this federate was elected leader during the federation coupling process. |
protected static java.net.InetAddress |
localhost
The IPv4 address of the host machine. |
protected uchicago.src.sim.engine.SimModel |
model
The RePast model which this Manager is hosting |
protected int |
numNodes
The number of nodes in the federation in total if the coupling process completed succesfully. |
protected ObjectLookup |
obLookup
A large catalogue of all published and discovered objects in the federation about which the local simulation is interested. |
protected hla.rti13.java1.RTIambassador |
rtiAmb
The RTIambassador which this Manager is communicating with |
protected java.sql.Timestamp |
sessionID
The session_id for this execution, used purely for logging |
protected static LocalManager |
singletonManager
A singleton instance (one LocalManager per JVM) |
Constructor Summary | |
---|---|
protected |
LocalManager(java.lang.Class[] classes,
int numNodes,
java.lang.String federateID,
java.lang.String fedName,
java.lang.String fedFile,
boolean create)
Creates the skeleton of a LocalManager, establishing only the basic machinery for two-way communication with the RTI. |
Method Summary | |
---|---|
void |
addLogicalTimeListener(LogicalTimeListener ltl)
Register a listener which will be notified whenever this federate is granted to advance its clock. |
void |
constrainedEnabled(double time)
|
protected void |
couple()
|
static LocalManager |
createManager(java.lang.Class[] classes,
int numNodes,
java.lang.String federationName,
java.lang.String fedFile)
This is the same as the larger form but sets the federate's ID to the local host name. |
static LocalManager |
createManager(java.lang.Class[] classes,
int numNodes,
java.lang.String federateID,
java.lang.String federationName,
java.lang.String fedFile)
This form is the same as the larger form but always tries to create the federation. |
static LocalManager |
createManager(java.lang.Class[] classes,
int numNodes,
java.lang.String federateID,
java.lang.String federationName,
java.lang.String fedFile,
boolean create)
Creates a LocalManager. |
void |
deletePublicObject(PublicObject obj)
Explicitly delete the (locally registered) public object from the federation. |
protected void |
endParticipation()
|
void |
endParticipation(boolean destroy)
Resign from the federation, removing all objects created and registered in the past by this federate. |
void |
flushCallbackBuffer()
|
void |
flushExternalEventQueueSngThrd()
|
hla.rti13.java1.RTIambassador |
getAmbassador()
Left public for development code (should not be needed by model code) |
java.lang.String |
getFederateID()
The String id for this federate (not necessarily unique). |
java.lang.String |
getFederationName()
The name of the federation. |
static hla.rti13.java1.AttributeHandleSet |
getHandleSet(int size)
|
static java.lang.String |
getHost()
Returns the hostname of the local machine |
static LocalManager |
getManager()
Get the LocalManager for this JVM. |
ProxyList |
getProxies(java.lang.Class global,
java.lang.Class local)
Obtains a list of objects of type local which are reflecting remotely published instances of type global. |
static hla.rti13.java1.RTIambassador |
getRTI()
Accesses the RTIambassador object itself. |
DistributedSchedule |
getSchedule()
Obtains a RePast Schedule object that has been modified to comply with distributed operation (i.e. |
java.sql.Timestamp |
getSessionID()
The session ID for this federation (should be unique for each federation execution, generated by the (randomly chosen) federation leader during the coupling process) |
static hla.rti13.java1.SuppliedAttributes |
getSuppliedAttributes(int size)
|
double |
getTick()
|
protected void |
initDatabase()
|
protected void |
join()
|
protected void |
print(java.lang.String message)
Print the given message to an appropriate output/log. |
void |
registerPublicObject(PublicObject obj)
Register a PublicObject with this LocalManager, handles registration of the object amongst the federation and sets certain accounting info for the object. |
static void |
setLazyDeletion(boolean lazy)
|
void |
simEventPerformed(uchicago.src.sim.engine.SimEvent evt)
Called by a simulation when a simulation-level event occurs (i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.net.InetAddress localhost
protected static LocalManager singletonManager
protected java.lang.String federateID
protected java.lang.String federationName
protected java.lang.String fedFile
protected boolean isLeader
protected boolean create
LocalManager(Class[], int, String, String, String, boolean)
protected int numNodes
protected java.lang.Class[] classes
protected java.sql.Timestamp sessionID
protected uchicago.src.sim.engine.SimModel model
protected hla.rti13.java1.RTIambassador rtiAmb
protected Coupler coupler
protected Advancer13 advancer
protected java.lang.Class[] fedTree
protected ClassLookup classLookup
protected manager.EventQueue externQueue
protected ObjectLookup obLookup
protected manager.CallbackBuffer cbDispatcher
externQueue
Constructor Detail |
---|
protected LocalManager(java.lang.Class[] classes, int numNodes, java.lang.String federateID, java.lang.String fedName, java.lang.String fedFile, boolean create) throws hla.rti13.java1.RTIexception, java.net.UnknownHostException, BadClassTreeException, java.lang.ClassNotFoundException
join()
, couple()
and initDatabase()
methods can then be used to create and join the federation in a stable
way.
classes
- the set of classes which will be instantiated in the local
model as either PublicObject or RemoteObject instances (or both).numNodes
- the total number of nodes which will be involved in this
federation.federateID
- the unique ID String of this federate. Does not need to be
unique but may be useful for debugging output.fedName
- the name of the federation to create/joinfedFile
- the .fed file to use to configure this federation. This
must contain the standard HLA_RePast object types needed to gracefully
couple of the federates together (see Coupler
)create
- whether this federate should attempt to create the federation
execution. At least one of the federates should have this argument set to
true. The LocalManager will handle the case of multiple federates attempting
to create, but initialisation will probably be slightly quicker if only
one does so.
hla.rti13.java1.RTIexception
- If any error occurs from the RTIambassador calls.
java.net.UnknownHostException
- If there is a problem attempting to obtain the
local host machine's IP address.
java.lang.ClassNotFoundException
BadClassTreeException
Method Detail |
---|
public static hla.rti13.java1.RTIambassador getRTI() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public static java.lang.String getHost()
java.net.UnknownHostException
public static LocalManager getManager()
public static void setLazyDeletion(boolean lazy)
protected void join() throws hla.rti13.java1.RTIexception
hla.rti13.java1.RTIexception
protected void couple() throws hla.rti13.java1.RTIexception
hla.rti13.java1.RTIexception
protected void initDatabase() throws hla.rti13.java1.RTIexception
hla.rti13.java1.RTIexception
public static LocalManager createManager(java.lang.Class[] classes, int numNodes, java.lang.String federateID, java.lang.String federationName, java.lang.String fedFile, boolean create) throws java.lang.Exception
classes
- the set of classes which will be instantiated in the local
model as either PublicObject or RemoteObject instances (or both).numNodes
- the total number of nodes which will be involved in this
federation.federateID
- the unique ID String of this federate. Does not need to be
unique but may be useful for debugging output.federationName
- the name of the federation to create/joinfedFile
- the .fed file to use to configure this federation. This
must contain the standard HLA_RePast object types needed to gracefully
couple of the federates together (see Coupler
)create
- whether this federate should attempt to create the federation
execution. At least one of the federates should have this argument set to
true. The LocalManager will handle the case of multiple federates attempting
to create, but initialisation will probably be slightly quicker if only
one does so.
hla.rti13.java1.RTIexception
- If any error occurs from the RTIambassador calls.
java.net.UnknownHostException
- If there is a problem attempting to obtain the
local host machine's IP address.
java.lang.Exception
public static LocalManager createManager(java.lang.Class[] classes, int numNodes, java.lang.String federateID, java.lang.String federationName, java.lang.String fedFile) throws java.lang.Exception
classes
- numNodes
- federateID
- federationName
- fedFile
-
java.lang.Exception
createManager(Class[], int, String, String, String, boolean)
public static LocalManager createManager(java.lang.Class[] classes, int numNodes, java.lang.String federationName, java.lang.String fedFile) throws java.lang.Exception
classes
- numNodes
- federationName
- fedFile
-
java.lang.Exception
createManager(Class[], int, String, String, String, boolean)
public hla.rti13.java1.RTIambassador getAmbassador()
public static hla.rti13.java1.AttributeHandleSet getHandleSet(int size) throws hla.rti13.java1.MemoryExhausted, hla.rti13.java1.ValueCountExceeded
hla.rti13.java1.MemoryExhausted
hla.rti13.java1.ValueCountExceeded
public static hla.rti13.java1.SuppliedAttributes getSuppliedAttributes(int size) throws hla.rti13.java1.MemoryExhausted, hla.rti13.java1.ValueCountExceeded, hla.rti13.java1.HandleValuePairMaximumExceeded
size
- the size of the SuppliedAttributes enumeration
hla.rti13.java1.MemoryExhausted
hla.rti13.java1.ValueCountExceeded
hla.rti13.java1.HandleValuePairMaximumExceeded
public double getTick()
public java.lang.String getFederateID()
public java.lang.String getFederationName()
public java.sql.Timestamp getSessionID()
public DistributedSchedule getSchedule() throws hla.rti13.java1.RTIexception
hla.rti13.java1.RTIexception
public void flushCallbackBuffer()
public void flushExternalEventQueueSngThrd()
public void registerPublicObject(PublicObject obj) throws hla.rti13.java1.RTIexception, java.io.IOException, BadClassException
hla.rti13.java1.RTIexception
java.io.IOException
BadClassException
public void deletePublicObject(PublicObject obj) throws hla.rti13.java1.RTIexception, ObjectNotFoundException
obj
- the object to delete
ObjectNotFoundException
- if the object with the given handle
was never registered or if it was registered but has already been
deleted. (The only situation in which the latter might happen is if
the object is cloned, then the original object is garbage collected.
If you are doing this, stop it, nobody is impressed.)
hla.rti13.java1.RTIexception
- in several cases, though if the federation is still
running happily, this is probably due to a failure in sanity checking in
the internal HLA_RePast engine code leading to a delete call on a
non-existent object.public ProxyList getProxies(java.lang.Class global, java.lang.Class local) throws hla.rti13.java1.FederateInternalError, hla.rti13.java1.RTIinternalError, java.lang.InstantiationException, java.lang.IllegalAccessException
Note that although global and local need not be unique, if the public attributes retrievable from local are not a strict subset of those retrievable from global, this list will remain at size 0 for ever.
global
- the Class of the objects as they were published remotelylocal
- the Class of the objects as they are to be stored in the list.
BadClassException
- if either class is not supported by this manager's internal
database (i.e. if the Class[] it was initialised with does
not contain one of the two classes).
hla.rti13.java1.FederateInternalError
hla.rti13.java1.RTIinternalError
java.lang.InstantiationException
java.lang.IllegalAccessException
public void simEventPerformed(uchicago.src.sim.engine.SimEvent evt)
simEventPerformed
in interface uchicago.src.sim.engine.SimEventListener
evt
- the SimEvent type that has occurredpublic void endParticipation(boolean destroy)
destroy
- Also attempt to destroy the federation execution itselfprotected void endParticipation()
public void addLogicalTimeListener(LogicalTimeListener ltl)
ltl
- the listenerpublic void constrainedEnabled(double time)
protected void print(java.lang.String message)
message
- the message to print
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |