|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcsp.net2.LinkFactory
public final class LinkFactory
This class is used to create a new Link from a given NodeID or NodeAddress.
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
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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 Node
IllegalArgumentException
- 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 to
JCSPNetworkException
- Thrown if anything goes wrong during the connection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |