public class ProxyModelInfrastructure
extends java.lang.Object
| Red (ahuseyno) |
| Red (ahuseyno) |
| Modifier and Type | Class and Description |
|---|---|
static interface |
ProxyModelInfrastructure.ProxyModelListener
The listener that notifies about events happening in the RemoteModel.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
QOS_LEVEL
The quality of service that would be required from the MQTT broker.
|
| Constructor and Description |
|---|
ProxyModelInfrastructure(ProxyModelBuilder.ProxyModelType modelType,
CompositeActor plainTopLevelActor)
Create a new instance of the proxy model infrastructure for the specified model type
from the plain model.
|
ProxyModelInfrastructure(ProxyModelBuilder.ProxyModelType modelType,
CompositeActor preprocessedTopLevelActor,
java.util.HashMap<java.lang.String,java.lang.String> modelTypes)
Create a new instance of the ProxyModelInfrastructure of the specified type from the model
that was previously converted to the one supporting distributed execution by replacing certain
named objects with proxy counterparts.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addProxyModelListener(ProxyModelInfrastructure.ProxyModelListener listener)
Add ProxyModelListener in order to listen for the model events such as
model expiration or exception events.
|
void |
close()
Close the model along with all its connection.
|
protected void |
finalize()
Close the model before finalizing.
|
void |
fireModelConnectionExpired()
Notify the model listeners about the model connection expiration.
|
void |
fireModelException(java.lang.String message,
java.lang.Throwable e)
Notify all model listeners that the simulation has experienced an exception.
|
void |
fireServerEvent(RemoteEventToken event)
Notify all model listeners that a server event has occurred.
|
java.util.concurrent.Executor |
getExecutor()
Return the executor to schedule short lived tasks.
|
Manager |
getManager()
Return the manager controlling this model.
|
int |
getMaxlatency()
Get maximum latency before the proxy sink threads are forced to sleep.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getModelTypes()
Return the model types for certain typeable object's.
|
long |
getPingPongLatency()
Return the roundtrip latency of sending ping/echo requests.
|
java.util.HashMap<java.lang.String,ProxySourceData> |
getProxySourceMap()
Return the mappings from remote source full names to their RemoteSourceData
data-structure.
|
java.util.HashMap<java.lang.String,ProxyValueListener> |
getRemoteAttributeListenersMap()
Return the map with RemoteValueListeners of the model's remote attributes.
|
java.util.HashMap<java.lang.String,Settable> |
getRemoteAttributesMap()
Return the mappings from remote attribute full names to their
remote Settable instance.
|
java.lang.String |
getSubscriptionTopic()
Return the subscription topic of the current model.
|
Ticket |
getTicket()
Return the ticket that uniquely identifies the model.
|
int |
getTimeoutPeriod()
Return the model's timeout period in milliseconds. if the
period is less or equal to 0, the model would never timeout.
|
TokenPublisher |
getTokenPublisher()
Return the tokenPublisher used to send and batch tokens.
|
CompositeActor |
getTopLevelActor()
Return the top level actor used for running distributed simulation.
|
boolean |
isStopped()
Return true if the model is stopped, otherwise return false.
|
void |
removeProxyModelListener(ProxyModelInfrastructure.ProxyModelListener listener)
Unsubscribe the listener from the model events.
|
void |
setLastPongToken(PongToken lastPongToken)
Set the PongToken instance that was received the last.
|
void |
setMaxLatency(int maxLatency)
Set the maximum latency before the proxy sink threads are forced to sleep.
|
void |
setStopped(boolean stopped)
Set the stopped state of the model.
|
void |
setTimeoutPeriod(int timeoutPeriod)
Set the model's timeout period in milliseconds.
|
Manager |
setUpInfrastructure(Ticket ticket,
java.lang.String brokerHostname)
Set up the communication infrastructure.
|
public static final int QOS_LEVEL
public ProxyModelInfrastructure(ProxyModelBuilder.ProxyModelType modelType, CompositeActor plainTopLevelActor) throws IllegalActionException, TypeConflictException, NameDuplicationException, java.lang.CloneNotSupportedException
modelType - the type of the model which must be either client or serverplainTopLevelActor - The topLevelActor that has attributes indicating remote objects
but that was not yet converted to the model supporting distributed execution.IllegalActionException - if there is a problem setting a manager or
capturing certain type information.TypeConflictException - if there is a problem resolving types on the model.NameDuplicationException - if there is a problem creating proxy sinks or sources.java.lang.CloneNotSupportedException - if there is a problem cloning ports or attributes.public ProxyModelInfrastructure(ProxyModelBuilder.ProxyModelType modelType, CompositeActor preprocessedTopLevelActor, java.util.HashMap<java.lang.String,java.lang.String> modelTypes) throws IllegalActionException
modelType - The type of the model which must be either client or serverpreprocessedTopLevelActor - the model that was previosly processed with ProxyModelBuider
and converted to the one supporting distributed execution.modelTypes - The map from the Typeable's full name to its type.IllegalActionException - if there is a problem parsing model types or
setting types on Typeable objects.public void addProxyModelListener(ProxyModelInfrastructure.ProxyModelListener listener)
listener - The listener to add.removeProxyModelListener(ProxyModelListener)public void close()
public void fireModelConnectionExpired()
public void fireModelException(java.lang.String message,
java.lang.Throwable e)
message - The message explaining what has happened.e - The exception (if any) that should be propagated.public void fireServerEvent(RemoteEventToken event)
event - The remote eventpublic java.util.concurrent.Executor getExecutor()
It's used to send PongTokens outside of the MQTT listener thread since MQTTClient disallows that.
public Manager getManager()
public int getMaxlatency()
setMaxLatency(int)public java.util.HashMap<java.lang.String,java.lang.String> getModelTypes()
public long getPingPongLatency()
public java.util.HashMap<java.lang.String,ProxySourceData> getProxySourceMap()
public java.util.HashMap<java.lang.String,ProxyValueListener> getRemoteAttributeListenersMap()
public java.util.HashMap<java.lang.String,Settable> getRemoteAttributesMap()
public java.lang.String getSubscriptionTopic()
public Ticket getTicket()
public int getTimeoutPeriod()
setTimeoutPeriod(int)public TokenPublisher getTokenPublisher()
public CompositeActor getTopLevelActor()
public boolean isStopped()
setStopped(boolean)public void removeProxyModelListener(ProxyModelInfrastructure.ProxyModelListener listener)
listener - The listener to remove.addProxyModelListener(ProxyModelListener)public void setLastPongToken(PongToken lastPongToken)
lastPongToken - The last PongToken.public void setMaxLatency(int maxLatency)
maxLatency - the maximum latency.getMaxlatency()public void setStopped(boolean stopped)
stopped - indicates if the model is stopped or not.isStopped()public void setTimeoutPeriod(int timeoutPeriod)
timeoutPeriod - the timeout period of the model.getTimeoutPeriod()public Manager setUpInfrastructure(Ticket ticket, java.lang.String brokerHostname) throws com.ibm.mqtt.MqttException, IllegalActionException
ticket - The ticket associated with this remote model.brokerHostname - The hostname of the MQTT broker.com.ibm.mqtt.MqttException - If there is a problem connecting to the broker.IllegalActionException - If there is problem creating the manager.protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable - If finalizing fails to close model and/or connections.Object.finalize()