All Packages Class Hierarchy This Package Previous Next Index
Class jcsp.lang.Many2ManyChannel
java.lang.Object
|
+----jcsp.lang.Many2ManyChannel
- public class Many2ManyChannel
- extends Object
- implements Channel
Description
The Many2ManyChannel is an implementation of an Channel which
is safe to use with many Reading Process and many Writing Process.
This implementation of the Channel uses Objects which conform to the
ChannelDataStore interface to store the data sent across the Channel. This
enables the storage policy to be defined when the channel is constructed.
Also system constructors can define their own storage types.
This class also defines two static methods that can be used to create
an array of Many2ManyChannel. The first of the two can be used to create
an array with the default ChannelDataStore and the second allows the
type of the ChannelDataStore to be specified.
- Author:
- P.D.Austin
-
data
- The ChannelDataStore used to store the data for the Channel
-
readMonitor
- The monitor reads must synchronize on
-
writeMonitor
- The monitor writes must synchronize on
-
Many2ManyChannel()
- Constructs a new Many2ManyChannel with a ZeroBuffer ChannelDataStore.
-
Many2ManyChannel(ChannelDataStore)
- Constructs a new Many2ManyChannel with the specified ChannelDataStore.
-
create(int)
- Creates an array of Many2ManyChannels.
-
create(int, ChannelDataStore)
- Creates an array of Many2ManyChannels using the specified ChannelDataStore.
-
read()
- Reads an Object from the Channel.
-
write(Object)
- Writes an Object to the Channel.
data
protected ChannelDataStore data
- The ChannelDataStore used to store the data for the Channel
readMonitor
protected Object readMonitor
- The monitor reads must synchronize on
writeMonitor
protected Object writeMonitor
- The monitor writes must synchronize on
Many2ManyChannel
public Many2ManyChannel()
- Constructs a new Many2ManyChannel with a ZeroBuffer ChannelDataStore.
Many2ManyChannel
public Many2ManyChannel(ChannelDataStore o)
- Constructs a new Many2ManyChannel with the specified ChannelDataStore.
- Parameters:
- data - The ChannelDataStore used to store the data for the Channel
read
public Object read()
- Reads an Object from the Channel. This method also ensures only one
of the readers can actually be reading at any time. All other readers
are blocked until it completes the read.
- Returns:
- The object returned from the Channel.
write
public void write(Object value)
- Writes an Object to the Channel. This method also ensures only one
of the writers can actually be writing at any time. All other writers
are blocked until it completes the write.
- Parameters:
- value - The object to write to the Channel.
create
public static Many2ManyChannel[] create(int n)
- Creates an array of Many2ManyChannels.
- Parameters:
- n - The number of channels to create in the array
- Returns:
- The array of Many2ManyChannel
create
public static Many2ManyChannel[] create(int n,
ChannelDataStore store)
- Creates an array of Many2ManyChannels using the specified ChannelDataStore.
- Parameters:
- n - The number of channels to create in the array
- Returns:
- The array of Many2ManyChannel
All Packages Class Hierarchy This Package Previous Next Index