java.lang.Object | |
↳ | uk.ac.imperial.presage2.core.network.NetworkController |
Known Direct Subclasses |
This is a central controller through which all messages go.
Like the environment it ensures agents obey the rules of the system. In this case these are to do with the network, such as transmission ranges etc.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DELIVER_MESSAGE_EVENTS_ENABLED | Whether or not to fire MessageDeliveryEvent for every message
that is delivered. |
||||||||||
HANDLER_DRAIN_LIMIT | Maximum number of Messages a MessageHandler will take from the queue at once. | ||||||||||
HANDLER_FORK_THRESHOLD | Queue size required to cause a MessageHandler to try and fork a new thread. | ||||||||||
MAX_THREADS | Maximum number of extra threads we will spawn to process messages with. | ||||||||||
TODELIVER_CAPACITY | Maximum capacity of the toDeliver queue. | ||||||||||
allowDelivery | |||||||||||
awaitingDelivery | |||||||||||
devices | Map of devices registered to this controller. | ||||||||||
environment | Access to environment shared state. | ||||||||||
eventBus | |||||||||||
threadPool | |||||||||||
threads | |||||||||||
time | |||||||||||
toDeliver | Queue of messages sent by agents which require processing. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked by a NetworkConnector when it wishes to send a message. | |||||||||||
Register a network device with this NetworkController
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Deliver a message m to recipient to.
| |||||||||||
Send a broadcast message
| |||||||||||
Send a multicast message
| |||||||||||
Send a unicast message
| |||||||||||
Return a Pong for the given Ping.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
uk.ac.imperial.presage2.core.TimeDriven
| |||||||||||
From interface
uk.ac.imperial.presage2.core.network.NetworkChannel
| |||||||||||
From interface
uk.ac.imperial.presage2.core.network.RequiresRegistration
|
Whether or not to fire MessageDeliveryEvent
for every message
that is delivered.
Maximum number of Messages a MessageHandler will take from the queue at once.
Queue size required to cause a MessageHandler to try and fork a new thread.
Maximum number of extra threads we will spawn to process messages with. Defaults to the same size as the threadpool.
Maximum capacity of the toDeliver queue. Using 0 gives a maximum sized queue.
Map of devices registered to this controller.
Access to environment shared state.
Queue of messages sent by agents which require processing.
Invoked by a NetworkConnector when it wishes to send a message.
In this implementation we deliver at the end of time cycle, therefore this function just adds the message to the delivery queue
Register a network device with this NetworkController
req | a Registration request. |
---|
If the request is null, or one of the request's parameters is null (Address or link). |
Deliver a message m to recipient to.
Return a Pong for the given Ping. This is a message
containing the set of NetworkAddress
es of devices we're connected
with.