Package org.jcsp.net2.mobile
Class MobileChannelInput
- java.lang.Object
-
- org.jcsp.net2.mobile.MobileChannelInput
-
- All Implemented Interfaces:
java.io.Serializable,ChannelInput,Poisonable,NetChannelInput,Networked
public final class MobileChannelInput extends java.lang.Object implements NetChannelInput, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private NetChannelInputactualInprivate NetChannelLocationmessageBoxLocprivate NetChannelLocationmsgBoxReqLocprivate NetChannelOutputtoMessageBox
-
Constructor Summary
Constructors Constructor Description MobileChannelInput()MobileChannelInput(NetworkMessageFilter.FilterTx encoder, NetworkMessageFilter.FilterRx decoder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroys the Networked constructvoidendRead()End an extended rendezvous.NetLocationgetLocation()Gets the networked location of the Networked constructvoidpoison(int strength)This injects poison into the channel.java.lang.Objectread()Read an Object from the channel.private voidreadObject(java.io.ObjectInputStream input)voidsetDecoder(NetworkMessageFilter.FilterRx decoder)Sets the underlying decoder for the channeljava.lang.ObjectstartRead()Begin an extended rendezvous read from the channel.private voidwriteObject(java.io.ObjectOutputStream output)
-
-
-
Field Detail
-
messageBoxLoc
private NetChannelLocation messageBoxLoc
-
msgBoxReqLoc
private NetChannelLocation msgBoxReqLoc
-
actualIn
private transient NetChannelInput actualIn
-
toMessageBox
private transient NetChannelOutput toMessageBox
-
-
Constructor Detail
-
MobileChannelInput
public MobileChannelInput()
-
MobileChannelInput
public MobileChannelInput(NetworkMessageFilter.FilterTx encoder, NetworkMessageFilter.FilterRx decoder)
-
-
Method Detail
-
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
-
read
public java.lang.Object read()
Description copied from interface:ChannelInputRead an Object from the channel.- Specified by:
readin interfaceChannelInput- Returns:
- the object read from the channel
-
startRead
public java.lang.Object 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
-
poison
public void poison(int strength)
Description copied from interface:PoisonableThis injects poison into the channel. If the channel was not explicitly constructed to be poisonable or if the strength of poison is not greater than the channel immunity level, the poison will have no effect.- Specified by:
poisonin interfacePoisonable- Parameters:
strength- the strength of the poison (must be >= 0).
-
destroy
public void destroy()
Description copied from interface:NetworkedDestroys the Networked construct
-
getLocation
public NetLocation getLocation()
Description copied from interface:NetworkedGets the networked location of the Networked construct- Specified by:
getLocationin interfaceNetworked- Returns:
- The location of the construct
-
setDecoder
public void setDecoder(NetworkMessageFilter.FilterRx decoder)
Description copied from interface:NetChannelInputSets the underlying decoder for the channel- Specified by:
setDecoderin interfaceNetChannelInput- Parameters:
decoder- The new decoder to use.
-
writeObject
private void writeObject(java.io.ObjectOutputStream output) throws java.io.IOException- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream input) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-