CSP for Java
(JCSP) 1.1-rc4

org.jcsp.lang
Class AltingConnectionClientImpl

java.lang.Object
  extended by org.jcsp.lang.Guard
      extended by org.jcsp.lang.AltingConnectionClient
          extended by org.jcsp.lang.AltingConnectionClientImpl
All Implemented Interfaces:
ConnectionClient
Direct Known Subclasses:
NetAltingConnectionClient, SharedAltingConnectionClient

public class AltingConnectionClientImpl
extends AltingConnectionClient

This class does not need to be used by standard JCSP users. It is exposed so that the connection mechanism can be extended for custom connections.

Author:
Quickstone Technologies Limited

Constructor Summary
protected AltingConnectionClientImpl(AltingChannelInput fromServer, ChannelOutput openToServer, ChannelOutput reqToServer, ChannelOutput backToClient)
          Constructs a new instance.
 
Method Summary
protected  void claim()
          This claims a lock on the client.
 boolean isOpen()
          Returns whether the server has kept its end of the Connection open.
protected  void release()
          This releases a lock on the client.
 Object reply()
          Receives some data back from the server after request(Object) has been called.
 void request(Object data)
          Sends some data over the connection to server once the connection has been opened.
 
Methods inherited from class org.jcsp.lang.AltingConnectionClient
getAltingChannel, pending, setAltingChannel
 
Methods inherited from class org.jcsp.lang.Guard
schedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AltingConnectionClientImpl

protected AltingConnectionClientImpl(AltingChannelInput fromServer,
                                     ChannelOutput openToServer,
                                     ChannelOutput reqToServer,
                                     ChannelOutput backToClient)
Constructs a new instance. This constructor must be called by a subclass which is responsible for creating the channels used by the connection and must pass them into this constructor.

Method Detail

request

public void request(Object data)
             throws IllegalStateException
Sends some data over the connection to server once the connection has been opened.

Parameters:
data - the Object to send to the server.
Throws:
IllegalStateException - if the method is called when it is not meant to be.

reply

public Object reply()
             throws IllegalStateException
Receives some data back from the server after request(Object) has been called.

Returns:
the Object sent from the server.
Throws:
IllegalStateException - if the method is called when it is not meant to be.

isOpen

public boolean isOpen()
               throws IllegalStateException
Returns whether the server has kept its end of the Connection open. This should only be called after a call to reply() and before any other Connection method is called.

Returns:
true iff the server has kept the connection open.
Throws:
IllegalStateException

claim

protected void claim()
This claims a lock on the client. This implementation does nothing as instances of this class are only meant to be used with One2?Connection objects.


release

protected void release()
This releases a lock on the client. This implementation does nothing as instances of this class are only meant to be used with One2?Connection objects.


CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.