public final class LinkFactory extends Object
It is perfectly reasonable for a user to create a Link to another Node without utilising the normal connection methods. This class is therefore made public to allow such an occurrence.
Example, using TCP/IP
TCPIPNodeAddress address = new TCPIPNodeAddress("192.168.1.100", 5000);
Link link = LinkFactory.getLink(address);
The getLink method will either return an existing Link if one exists, or it shall create a new one if necessary.
Using this method allows quick creation of channels / barrier on a remote Node without going through the normal name servers. For example:
NetChannelLocation loc = new NetChannelLocation(link.getRemoteNodeID(), 100);
NetChannelOutput out = NetChannelEnd.one2net(loc);
This method is generally considered faster than using the CNS, or creating channels just using the address and VCN. It does require the user to know the address and channel number that is to be connected too.
Link
,
NodeAddress
,
NodeID
Modifier and Type | Method and Description |
---|---|
static Link |
getLink(NodeAddress addr)
Creates a new Link, or retrieves an existing one, from a NodeAddress
|
static Link |
getLink(NodeID nodeID)
Creates a new Link or gets an existing one from the the given NodeID.
|
public static Link getLink(NodeID nodeID) throws JCSPNetworkException, IllegalArgumentException
nodeID
- NodeID of the Node to connect to.JCSPNetworkException
- Thrown if there is a problem connecting to the NodeIllegalArgumentException
- Thrown if an attempt is made to connect to the local Nodepublic static Link getLink(NodeAddress addr) throws JCSPNetworkException
addr
- The NodeAddress of the Node to connect toJCSPNetworkException
- Thrown if anything goes wrong during the connectionCopyright © 1996–2016. All rights reserved.