final class Any2NetChannel<T> extends java.lang.Object implements NetSharedChannelOutput<T>
NetSharedChannelOutput
Modifier and Type | Field and Description |
---|---|
private One2NetChannel |
chan
The underlying One2NetChannel used by this channel.
|
Modifier | Constructor and Description |
---|---|
private |
Any2NetChannel(One2NetChannel channel)
Constructor wrapping an existing One2NetChannel in an Any2NetChannel
|
Modifier and Type | Method and Description |
---|---|
void |
asyncWrite(T object)
Writes asynchronously to the underlying channel.
|
(package private) static <T2> Any2NetChannel<T2> |
create(NetChannelLocation loc,
int immunity,
NetworkMessageFilter.FilterTx filter)
Static factory method used to create an Any2NetChannel
|
void |
destroy()
Removes the channel from the ChannelManager, and sets the state to DESTROYED
|
NetLocation |
getLocation()
Gets the NetChannelLocation of the input end this channel is connected to.
|
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 underlying channel.
|
private final One2NetChannel chan
private Any2NetChannel(One2NetChannel channel)
channel
- The One2NetChannel to be wrapped.static <T2> Any2NetChannel<T2> create(NetChannelLocation loc, int immunity, NetworkMessageFilter.FilterTx filter) throws JCSPNetworkException
loc
- The location of the input channel endimmunity
- The immunity level of the channelfilter
- The filter used to convert the object being sent into bytesJCSPNetworkException
- Thrown if a connection to the Node cannot be made.public void poison(int strength)
poison
in interface Poisonable
strength
- The strength of the poison being put on the channelpublic NetLocation getLocation()
getLocation
in interface Networked
public void write(T object) throws JCSPNetworkException, PoisonException
write
in interface ChannelOutput<T>
object
- The Object to write to the channelJCSPNetworkException
- Thrown if something happens in the underlying architecturePoisonException
- Thrown if the channel has been poisoned.public void asyncWrite(T object) throws JCSPNetworkException, PoisonException
asyncWrite
in interface NetChannelOutput<T>
object
- The object to write to the channelJCSPNetworkException
- Thrown if something happens in the underlying architecturePoisonException
- Thrown is the channel has been poisonedpublic void destroy()
public void setEncoder(NetworkMessageFilter.FilterTx encoder)
setEncoder
in interface NetChannelOutput<T>
encoder
- The new message filter to use