Class LinkManager
java.lang.Object
org.jcsp.net.LinkManager
- All Implemented Interfaces:
CSProcess
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic classprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate final Any2OneChannelprivate final Any2OneChannelprivate static LinkManagerprivate final Any2OneChannelprivate HashtableThe active links.private LoopbackLinkThe LoopBackLink used for local connections.private final Any2OneChannelprivate final Any2OneConnectionprivate final Any2OneChannelprivate final Any2OneChannel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static LinkManagerGet the singleton instance of LinkManager.private LinkGet a Link to a remote PC.(package private) AltingChannelInput(package private) ChannelOutputgetTxChannel(NodeAddressID targetAddress) This is used to get a Link when no details are known about the other Node except for one of its addresses.(package private) ChannelOutputgetTxChannel(NodeID target) Get a channel to use to send to a remote PC.(package private) ChannelOutputgetTxChannel(NodeID target, Profile linkProfile) (package private) booleanlinkExists(NodeID otherNode) This method tests whether a link exists to a specified remote Node in thisLinkManager.(package private) intCalled by a Link to indicate the link broke.(package private) voidregisterFailure(Link conn) (package private) booleanregisterLink(Link conn) Register a Link in the database.voidrun()Used to run theLinkManager.voidstart()Starts this instance of theLinkManagerand returns.
-
Field Details
-
instance
-
linkHolders
The active links. This is a hashtable where the key is a NodeID and the value is a Link.- See Also:
-
loopbackLink
The LoopBackLink used for local connections. -
registerConn
-
requestLink
-
lostLinkChan
-
linkFailureChan
-
checkForLink
-
getNodeIDChan
-
registerEventChannel
-
ALT_LOST_LINK
private static final int ALT_LOST_LINK- See Also:
-
ALT_LINK_FAIL
private static final int ALT_LINK_FAIL- See Also:
-
ALT_REG_CHAN
private static final int ALT_REG_CHAN- See Also:
-
ALT_REQ_LINK
private static final int ALT_REQ_LINK- See Also:
-
ALT_CHECK_FOR_LINK
private static final int ALT_CHECK_FOR_LINK- See Also:
-
-
Constructor Details
-
LinkManager
LinkManager()
-
-
Method Details
-
run
-
start
public void start()Starts this instance of theLinkManagerand returns. -
getInstance
Get the singleton instance of LinkManager.- Returns:
- The singleton LinkManager object.
-
registerLink
Register a Link in the database. Prevents duplicates. Returns true if there was no prior entry for that NodeID, and one was added. (In that case it has also notified any waiting processes). Returns false (and does not change the database) if there is an existing entry.- Returns:
- true iff there was no prior entry for that NodeID
-
registerFailure
-
getTxChannel
Get a channel to use to send to a remote PC. Will block (possibly forever) while the link is being established.- Parameters:
target- The system to connect to.- Returns:
- The Channel to use to send to the requested computer.
- Throws:
IllegalStateException- If init() has not been called.
-
getTxChannel
-
getTxChannel
This is used to get a Link when no details are known about the other Node except for one of its addresses. A typical situation when this would be used is to connect to the CNS.- Parameters:
targetAddress- The address to which to create a link.- Returns:
- the ChannelOuput that writes to the link.
-
getLink
Get a Link to a remote PC. Will block (possibly forever) while the link is being established.- Parameters:
target- The system to connect to.- Returns:
- The Link to the requested computer.
- Throws:
IllegalStateException- If init() has not been called.
-
lostLink
Called by a Link to indicate the link broke.- Parameters:
conn- The broken link.
-
linkExists
This method tests whether a link exists to a specified remote Node in thisLinkManager.- Parameters:
otherNode- TheNodeIDof a remote Node to check the existance- Returns:
trueiff a link currently exists to the specified remote Node.
-
getLinkLostEventChannel
AltingChannelInput getLinkLostEventChannel()
-