Package org.jcsp.net
Class LinkManager.LinksToNodeHolder
java.lang.Object
org.jcsp.net.LinkManager.LinksToNodeHolder
- Enclosing class:
- LinkManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
This sends the supplied link to any processes that are waiting for matching link.boolean
joinQueue
(ChannelOutput channel, Profile profile) This method allows processes to join a queue waiting for a link to a Node (with a known NodeID) to be established.int
notifyQueuedProcesses
(Profile profile, Object toSend) int
notifyQueuedProcesses
(Specification[] specs, Link linkToSend) This takes a set of link specifications, looks through the set of queues, checks whether the specifications meet requirements of the profile of a queue, and if so, sends the supplied Link to the processes in that queue.void
removeLink
(Link conn)
-
Field Details
-
target
-
links
-
linkWithNoSpecifiedFacilities
A link with no special facilities. This is so that if no features are required then no iteration will be needed. -
waiting
The processes waiting for a link. The key is the FacilitiesRequired of the link we're waiting for, the value is the channel to the waiting process (or a Vector of these). When the link is available, we notify the process(es) by sending the Link down the channel(s).
-
-
Constructor Details
-
LinksToNodeHolder
-
-
Method Details
-
getLink
-
getTarget
-
addLink
This sends the supplied link to any processes that are waiting for matching link. If there were some processes waiting or theaddIfNoQueue
parameter was true, then the link is added to this link manager.- Parameters:
link
- the Link to add.addIfNoQueue
- boolean inidicating whether to add the link if there were no queued processes.- Returns:
- the number of processes to which this link was sent.
-
notifyQueuedProcesses
-
notifyQueuedProcesses
This takes a set of link specifications, looks through the set of queues, checks whether the specifications meet requirements of the profile of a queue, and if so, sends the supplied Link to the processes in that queue. The method returns the number of queues that were notified.- Parameters:
specs
- an array of Specifcation objects that the link provides.linkToSend
- the link to send to the queued processes.- Returns:
- the number of queues that were notified.
-
removeLink
-
joinQueue
This method allows processes to join a queue waiting for a link to a Node (with a known NodeID) to be established. An infinite buffered channel is supplied. When it is known that a link has been created or failed to be created, notification can be sent down the supplied channel to the waiting process. There is one queue per link required matching matching a given profile. When a link is established, the profile of each queue is tested against the link and, if the profile matches, then all queued processes are notified. This can mean that multiple links to a remote Node might be established but by the time a link has been established, there may be no processes waiting for it as other links may have met their requirements.- Parameters:
channel
- the channel to put in the queue.profile
- the profile that the required link must meet.- Returns:
- a boolean inidicating whether the channel is the first in the queue and hence the link needs to be initiated.
-