Class Net2AnyChannel
- All Implemented Interfaces:
ChannelInput,Poisonable,SharedChannelInput,NetChannelInput,NetSharedChannelInput,Networked
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RejectableChannelThe local channel used for output from the recieving processprivate final StringThe channel name.private NetChannelInputProcess -
Constructor Summary
ConstructorsConstructorDescriptionCreates an anonymous input channel.Net2AnyChannel(String label) Net2AnyChannel(String label, ChannelDataStore buffer) Net2AnyChannel(ChannelDataStore buffer) Creates an anonymous, buffered input channel. -
Method Summary
Modifier and TypeMethodDescriptionvoidDestroys the channel end and frees any resources within the JCSP.NET infrastructure.voidendRead()End an extended rendezvous.Returns the location of theNetworkedChannelInput.Returns a Class file of the factory used to construct the channel end.voidpoison(int strength) Currently, network channels are unpoisonable so this method has no effect.read()Read data from this channel.Begin an extended rendezvous read from the channel.
-
Field Details
-
label
The channel name. -
ch
The local channel used for output from the recieving process -
netChannelInputProcess
-
-
Constructor Details
-
Net2AnyChannel
- Throws:
NullPointerException
-
Net2AnyChannel
public Net2AnyChannel()Creates an anonymous input channel.
To create writers that write to this channel, you need to call getChannelName() to get a valid name for this channel. You will need to use some other means (e.g. a named channel) to pass the channel name to the writing computer.
-
Net2AnyChannel
Creates an anonymous, buffered input channel.
To create writers that write to this channel, you need to call getChannelName() to get a valid name for this channel. You will need to use some other means (e.g. a named channel) to pass the channel name to the writing computer.
- Parameters:
buffer- The ChannelDataStore to use.
-
Net2AnyChannel
-
-
Method Details
-
read
Read data from this channel. This can safely be called by multiple readers.- Specified by:
readin interfaceChannelInput- Returns:
- The object read from the network.
-
startRead
Description copied from interface:ChannelInputBegin an extended rendezvous read from the channel. An extended rendezvous is not completed until the reader has completed its extended action. This method starts an extended rendezvous. When a writer to this channel writes, this method returns what was sent immediately. The extended rendezvous continues with reader actions until the reader invokes. Only then will the writer be released (from itsendReadmethod). The writer is unaware of the extended nature of the communication.writeThe reader process must call
at some point after this function, otherwise the writer will not be freed and deadlock will probably follow.endReadThe reader process may perform any actions between calling
andstartRead, including communications on other channels. Further communications on this channel, of course, should not be made.endReadAn extended rendezvous may be started after the channel's Guard has been selected by an
Alternative(i.e.instead ofstartRead).read- Specified by:
startReadin interfaceChannelInput- Returns:
- The object read from the channel
-
endRead
public void endRead()Description copied from interface:ChannelInputEnd an extended rendezvous. It must be invoked once (and only once) following a.startRead- Specified by:
endReadin interfaceChannelInput
-
poison
public void poison(int strength) Currently, network channels are unpoisonable so this method has no effect.- Specified by:
poisonin interfacePoisonable- Parameters:
strength- the strength of the poison (must be >= 0).
-
getChannelLocation
Description copied from interface:NetworkedReturns the location of theNetworkedChannelInput.- Specified by:
getChannelLocationin interfaceNetworked- Returns:
- the
NetChannelLocationobject.
-
getFactoryClass
Description copied from interface:NetChannelInputReturns a Class file of the factory used to construct the channel end.
- Specified by:
getFactoryClassin interfaceNetChannelInput- Returns:
- the
Classof the factory class.
-
destroyReader
public void destroyReader()Description copied from interface:NetChannelInputDestroys the channel end and frees any resources within the JCSP.NET infrastructure.
- Specified by:
destroyReaderin interfaceNetChannelInput
-