org.jcsp.net2.mobile
Class MobileChannelInput

java.lang.Object
  extended by org.jcsp.net2.mobile.MobileChannelInput
All Implemented Interfaces:
Serializable, ChannelInput, Poisonable, NetChannelInput, Networked

public final class MobileChannelInput
extends Object
implements NetChannelInput, Serializable

See Also:
Serialized Form

Constructor Summary
MobileChannelInput()
           
MobileChannelInput(NetworkMessageFilter.FilterTx encoder, NetworkMessageFilter.FilterRx decoder)
           
 
Method Summary
 void destroy()
          Destroys the Networked construct
 void endRead()
          End an extended rendezvous.
 NetLocation getLocation()
          Gets the networked location of the Networked construct
 void poison(int strength)
          This injects poison into the channel.
 Object read()
          Read an Object from the channel.
 void setDecoder(NetworkMessageFilter.FilterRx decoder)
          Sets the underlying decoder for the channel
 Object startRead()
          Begin an extended rendezvous read from the channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MobileChannelInput

public MobileChannelInput()

MobileChannelInput

public MobileChannelInput(NetworkMessageFilter.FilterTx encoder,
                          NetworkMessageFilter.FilterRx decoder)
Method Detail

endRead

public void endRead()
Description copied from interface: ChannelInput
End an extended rendezvous. It must be invoked once (and only once) following a startRead.

Specified by:
endRead in interface ChannelInput

read

public Object read()
Description copied from interface: ChannelInput
Read an Object from the channel.

Specified by:
read in interface ChannelInput
Returns:
the object read from the channel

startRead

public Object startRead()
Description copied from interface: ChannelInput
Begin 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 endRead. Only then will the writer be released (from its write method). The writer is unaware of the extended nature of the communication.

The reader process must call endRead at some point after this function, otherwise the writer will not be freed and deadlock will probably follow.

The reader process may perform any actions between calling startRead and endRead, including communications on other channels. Further communications on this channel, of course, should not be made.

An extended rendezvous may be started after the channel's Guard has been selected by an Alternative (i.e. startRead instead of read).

Specified by:
startRead in interface ChannelInput
Returns:
The object read from the channel

poison

public void poison(int strength)
Description copied from interface: Poisonable
This 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:
poison in interface Poisonable
Parameters:
strength - the strength of the poison (must be >= 0).

destroy

public void destroy()
Description copied from interface: Networked
Destroys the Networked construct

Specified by:
destroy in interface Networked

getLocation

public NetLocation getLocation()
Description copied from interface: Networked
Gets the networked location of the Networked construct

Specified by:
getLocation in interface Networked
Returns:
The location of the construct

setDecoder

public void setDecoder(NetworkMessageFilter.FilterRx decoder)
Description copied from interface: NetChannelInput
Sets the underlying decoder for the channel

Specified by:
setDecoder in interface NetChannelInput
Parameters:
decoder - The new decoder to use.


Copyright © 1996-2012. All Rights Reserved.