public abstract class Link extends java.lang.Object implements CSProcess
NetworkProtocol
Modifier and Type | Class and Description |
---|---|
(package private) class |
Link.RxLoop
The RxLoop for the Link.
|
(package private) class |
Link.TxLoop
The TxLoop for the Link.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
connected
A flag used to indicate whether the Link is connected or not.
|
private java.util.Hashtable |
connectedBarriers
This Hashtable is used to keep track of the current barriers that are connected to this Link.
|
private java.util.Hashtable |
connectedOutputs
This Hashtable is used to keep track of the current output channels that are connected to this Link.
|
static int |
LINK_PRIORITY
Link priority in the system.
|
protected int |
priority
Link priority for this Link.
|
protected NodeID |
remoteID
The NodeID of the opposite end of the connection.
|
protected java.io.DataInputStream |
rxStream
The incoming stream for the connection.
|
private Any2OneChannel |
txChannel
The channel connected to the Link Tx process.
|
protected java.io.DataOutputStream |
txStream
The outgoing stream for the connection.
|
Constructor and Description |
---|
Link() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
connect()
Connects to the remote Node.
|
protected abstract boolean |
createResources()
Creates the resources (if any) required for the Node.
|
(package private) void |
deRegisterBarrier(BarrierData data)
Unregisters a barrier with the Link
|
(package private) void |
deRegisterChannel(ChannelData data)
Unregisters and removes the channel from the Link.
|
protected abstract void |
destroyResources()
Destroys any used resources.
|
NodeID |
getRemoteNodeID()
Returns the NodeID of the connected Link.
|
protected ChannelOutput |
getTxChannel()
Gets the channel that is connected to the Link Tx process.
|
protected void |
lostLink()
Marks the Link as lost within the LinkManager.
|
(package private) void |
registerBarrier(BarrierData data)
Registers a barrier with the Link
|
(package private) void |
registerChannel(ChannelData data)
Register a channel with the Link.
|
boolean |
registerLink()
Registers the Link with the LinkManager
|
void |
run()
The run method for the process.
|
protected boolean connected
protected java.io.DataInputStream rxStream
protected java.io.DataOutputStream txStream
private final Any2OneChannel txChannel
protected NodeID remoteID
public static int LINK_PRIORITY
protected int priority
private java.util.Hashtable connectedOutputs
private java.util.Hashtable connectedBarriers
public final NodeID getRemoteNodeID()
protected final ChannelOutput getTxChannel()
public abstract boolean connect() throws JCSPNetworkException
JCSPNetworkException
- Thrown if the connection fails.protected abstract boolean createResources() throws JCSPNetworkException
JCSPNetworkException
- Thrown if a problem occurs creating the resources.protected abstract void destroyResources()
public final boolean registerLink()
protected final void lostLink()
void registerChannel(ChannelData data)
data
- The ChannelData object representing the channelvoid deRegisterChannel(ChannelData data)
data
- The ChannelData object representing the channel.void registerBarrier(BarrierData data)
data
- The barrier to register with the Linkvoid deRegisterBarrier(BarrierData data)
data
- The BarrierData representing the Barrier to unregister