Package org.jcsp.net2

Class NetAltingConnectionServer

    • Method Detail

      • 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
      • reply

        public void reply​(java.lang.Object data,
                          boolean close)
                   throws java.lang.IllegalStateException
        Description copied from interface: ConnectionServer

        Sends some data back to the client after a request has been received. The boolean close parameter indicates whether the connection should be closed after this reply has been sent.

        This method should not block.

        Specified by:
        reply in interface ConnectionServer
        Parameters:
        data - the data to send back to client.
        close - boolean that should be true iff the connection should be dropped after the reply has been sent.
        Throws:
        java.lang.IllegalStateException
      • reply

        public void reply​(java.lang.Object data)
                   throws java.lang.IllegalStateException
        Description copied from interface: ConnectionServer

        Sends some data back to the client after a request has been received but keeps the connection open. After calling this method, the server should call recieve() to receive a further request.

        A call to this method is equivalent to a call to reply(Object, boolean) with the boolean set to false.

        Specified by:
        reply in interface ConnectionServer
        Parameters:
        data - the data to send to the client.
        Throws:
        java.lang.IllegalStateException
      • replyAndClose

        public void replyAndClose​(java.lang.Object data)
                           throws java.lang.IllegalStateException
        Description copied from interface: ConnectionServer

        Sends some data back to the client and closes the connection.

        A call to this method is equivalent to a call to reply(Object, boolean) with the boolean set to true.

        Specified by:
        replyAndClose in interface ConnectionServer
        Parameters:
        data - the data to send back to client.
        Throws:
        java.lang.IllegalStateException
      • request

        public java.lang.Object request()
                                 throws java.lang.IllegalStateException
        Description copied from interface: ConnectionServer

        Receives a request from a client. This will block until the client calls its request(Object) method. Implementations may make this ALTable.

        After this method has returned, the server should call one of the reply methods. Performing any external process synchronization between these method calls could be potentially hazardous and could lead to deadlock.

        Specified by:
        request in interface ConnectionServer
        Returns:
        the Object sent by the client.
        Throws:
        java.lang.IllegalStateException