final class One2NetChannel<T> extends java.lang.Object implements NetChannelOutput<T>
NetChannelOutput
,
NetChannel
Modifier and Type | Field and Description |
---|---|
private ChannelData |
data
A structure containing the information on the state of the channel.
|
private boolean |
isLocal
Flag to determine if this is a locally connected channel or not
|
private Link |
linkConnectedTo
The actual Link this output channel sends on.
|
private ChannelData |
localChannel
This is used if we are ever connected locally.
|
private NetChannelLocation |
localLocation
The local channel end location
|
private NetworkMessageFilter.FilterTx |
messageFilter
The filter used to encode outgoing messages
|
private NetChannelLocation |
remoteLocation
The location that this channel is connected to (the input channel ends location)
|
private AltingChannelInput |
theAckChannel
The channel used to receive acknowledgements from the input end via the Link.
|
private ChannelOutput |
toLinkTx
The channel connecting to the Link that connects to the networked input end of this channel.
|
Modifier | Constructor and Description |
---|---|
private |
One2NetChannel(AltingChannelInput ackChannel,
ChannelOutput toLink,
Link link,
ChannelData chanData,
NetChannelLocation loc,
int immunity,
NetworkMessageFilter.FilterTx filter)
Private constructor for creating a One2NetChannel.
|
Modifier and Type | Method and Description |
---|---|
void |
asyncWrite(T object)
Asynchronously writes an object to the channel
|
(package private) static <T2> One2NetChannel<T2> |
create(NetChannelLocation loc,
int immunity,
NetworkMessageFilter.FilterTx filter)
Creates a new One2NetChannel by connecting to an already created NetChannelInput
|
void |
destroy()
Destroys the channel and removes it from the ChannelManager.
|
(package private) ChannelData |
getChannelData()
Gets the channel data state for this channel.
|
NetLocation |
getLocation()
Gets the NetChannelLocation that this channel is connected to (i.e.
|
(package private) NetChannelLocation |
localLocation()
Gets the local NetChannelLocation that represents this channel.
|
void |
poison(int strength)
Poisons the underlying channel.
|
void |
setEncoder(NetworkMessageFilter.FilterTx encoder)
Sets the underlying message filter
|
void |
write(T object)
Writes an object to the input end
|
private final ChannelOutput toLinkTx
private final Link linkConnectedTo
private final ChannelData localChannel
private final AltingChannelInput theAckChannel
private final ChannelData data
private final NetChannelLocation remoteLocation
private final NetChannelLocation localLocation
private final boolean isLocal
private NetworkMessageFilter.FilterTx messageFilter
private One2NetChannel(AltingChannelInput ackChannel, ChannelOutput toLink, Link link, ChannelData chanData, NetChannelLocation loc, int immunity, NetworkMessageFilter.FilterTx filter)
ackChannel
- The channel used to receive acknowledgements from LinkstoLink
- The channel used to send messages to the input endlink
- The Link that this channel is connected tochanData
- The structure used to store the state of the channelloc
- The location of the input end that this channel is connected toimmunity
- The poison immunity level of the channelfilter
- Filter used to encode outgoing messagesstatic <T2> One2NetChannel<T2> create(NetChannelLocation loc, int immunity, NetworkMessageFilter.FilterTx filter) throws JCSPNetworkException
loc
- The location of the NetChannelInputimmunity
- The immunity level of the channelfilter
- The filter used to encode outgoing messagesJCSPNetworkException
- Thrown if the connection to the remote Node failspublic void poison(int strength)
poison
in interface Poisonable
strength
- The strength of the poison being placed on the channelpublic NetLocation getLocation()
getLocation
in interface Networked
NetChannelLocation localLocation()
public void write(T object) throws JCSPNetworkException, PoisonException
write
in interface ChannelOutput<T>
object
- The object to send to the input end.JCSPNetworkException
- Thrown if something goes wrong in the network architecturePoisonException
- Thrown if the channel has been poisonedpublic void asyncWrite(T object) throws JCSPNetworkException, PoisonException
asyncWrite
in interface NetChannelOutput<T>
object
- The object being written to the channelJCSPNetworkException
- Thrown when something goes wrong in the network architecturePoisonException
- Thrown if the channel is poisonedfinal ChannelData getChannelData()
public void destroy()
public void setEncoder(NetworkMessageFilter.FilterTx encoder)
setEncoder
in interface NetChannelOutput<T>
encoder
- The new message filter to use