Package org.jcsp.net
Class Any2NetChannel
java.lang.Object
org.jcsp.net.Any2NetChannel
- All Implemented Interfaces:
Serializable
,ChannelOutput
,Poisonable
,SharedChannelOutput
,NetChannelOutput
,NetSharedChannelOutput
,Networked
A channel for network output (TX). This is a "Any2Net" channel,
which can be safely used by multiple writers.
Note that this is merely a thread-safe wrapper around
One2NetChannel
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAny2NetChannel
(NetChannelLocation channelLocation) Equivalent to the(NetChannelLocation)
constructor ofOne2NetChannel
.Any2NetChannel
(NetChannelLocation channelLocation, boolean acknowledged) Equivalent to the(NetChannelLocation, boolean)
constructor ofOne2NetChannel
.Any2NetChannel
(NetChannelLocation channelLocation, boolean acknowledged, Profile linkProfile) Equivalent to the(NetChannelLocation, boolean, Profile)
constructor ofOne2NetChannel
.Any2NetChannel
(NetChannelLocation channelLocation, Profile linkProfile) Equivalent to the(NetChannelLocation, Profile)
constructor ofOne2NetChannel
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Destroys the write end of a channel and frees any resources used within the JCSP networking infrastructure.Public accessor for obtaining the location of the read end of this channel.Returns the factory class used for constructing this channel end object.void
poison
(int strength) Currently, network channels are unpoisonable so this method has no effect.void
recreate()
Requests that the channel recreates itself and reconnects to the other end of the channel.void
Requests that the channel recreates itself and reconnects to the other end of the channel.void
Output data to this channel.
-
Field Details
-
impl
Implementation
-
-
Constructor Details
-
Any2NetChannel
Equivalent to the(NetChannelLocation)
constructor ofOne2NetChannel
.- See Also:
-
Any2NetChannel
Equivalent to the(NetChannelLocation, boolean)
constructor ofOne2NetChannel
.- See Also:
-
Any2NetChannel
Equivalent to the(NetChannelLocation, Profile)
constructor ofOne2NetChannel
.- See Also:
-
Any2NetChannel
public Any2NetChannel(NetChannelLocation channelLocation, boolean acknowledged, Profile linkProfile) Equivalent to the(NetChannelLocation, boolean, Profile)
constructor ofOne2NetChannel
.- See Also:
-
-
Method Details
-
write
Output data to this channel. The data must be Serializable.Note that this is merely a thread-safe wrapper around
One2NetChannel.write(Object)
- see that method for full documentation.- Specified by:
write
in interfaceChannelOutput
- Parameters:
data
- The data to send over the channel. The object should implement theSerializable
interface in order to be sent over a network.
-
getChannelLocation
Public accessor for obtaining the location of the read end of this channel.- Specified by:
getChannelLocation
in interfaceNetworked
- Returns:
- a
NetChannelLocation
object containing information needed to connect to
-
recreate
public void recreate()Requests that the channel recreates itself and reconnects to the other end of the channel.- Specified by:
recreate
in interfaceNetChannelOutput
-
recreate
Requests that the channel recreates itself and reconnects to the other end of the channel. A new reader location must be supplied.- Specified by:
recreate
in interfaceNetChannelOutput
- Parameters:
loc
- the new location of the reader.
-
destroyWriter
public void destroyWriter()Destroys the write end of a channel and frees any resources used within the JCSP networking infrastructure.- Specified by:
destroyWriter
in interfaceNetChannelOutput
-
getFactoryClass
Description copied from interface:NetChannelOutput
Returns the factory class used for constructing this channel end object.
- Specified by:
getFactoryClass
in interfaceNetChannelOutput
- Returns:
- the
Class
of the
-
poison
public void poison(int strength) Currently, network channels are unpoisonable so this method has no effect.- Specified by:
poison
in interfacePoisonable
- Parameters:
strength
- the strength of the poison (must be >= 0).
-