public abstract class AltingConnectionClient<T> extends Guard implements ConnectionClient<T>
This class is sub-classed by JCSP.NET classes
to provide ConnectionClient
objects which can
have their receive()
method alted over.
Although JCSP users could sub-class this class, under most
circumstances, there is no need. AltingConnectionClient
objects can be constructed using one of the Connection factory
mechanisms. See
and
Connection
.
StandardConnectionFactory
Modifier and Type | Field and Description |
---|---|
private AltingChannelInput<T> |
altingChannel
The channel used to ALT over.
|
Modifier | Constructor and Description |
---|---|
protected |
AltingConnectionClient(AltingChannelInput<T> altingChannel)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
disable()
Disables the guard for selection.
|
(package private) boolean |
enable(Alternative alt)
Returns true if the event is ready.
|
protected AltingChannelInput<T> |
getAltingChannel()
Returns the channel used to implement the Guard.
|
boolean |
pending()
Returns whether there is an open() pending on this connection.
|
protected void |
setAltingChannel(AltingChannelInput<T> chan)
ConnectionServer implementations are likely to be
implemented over channels. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isOpen, reply, request
private AltingChannelInput<T> altingChannel
protected AltingConnectionClient(AltingChannelInput<T> altingChannel)
Constructor.
Note that this is only intended for use by JCSP, and should not be called by user processes. Users should use one of the subclasses.
altingChannel
- The channel used to implement the Guardprotected AltingChannelInput<T> getAltingChannel()
Returns the channel used to implement the Guard.
Note that this method is only intended for use by JCSP, and should not be called by user processes.
Concrete subclasses should override this method to return null, to ensure that the alting channel is kept private.
protected void setAltingChannel(AltingChannelInput<T> chan)
ConnectionServer
implementations are likely to be
implemented over channels. Multiple channels from the client
to server may be used; one could be used for the initial
connection while another one could be used for data requests.
This method allows sub-classes to specify which channel should be the next one to be alted over.
chan
- the channel to be ALTed over.boolean enable(Alternative alt)
Returns true if the event is ready. Otherwise, this enables the guard for selection and returns false.
Note: this method should only be called by the Alternative class
boolean disable()
Disables the guard for selection. Returns true if the event was ready.
Note: this method should only be called by the Alternative class
public boolean pending()
Returns whether there is an open() pending on this connection.
Note: if there is, it won't go away until you accept it. But if there isn't, there may be one by the time you check the result of this method.