Package org.jcsp.lang

Class One2OneCallChannel

    • Field Detail

      • server

        protected CSProcess server
        This holds a reference to a server process so that a client may make the call. The reference is only valid between the join and fork elements of the standard calling sequence. As shown in that sequence, it will need casting up to the relevant interface supported by the specific CALL channel derived from this class.
      • selected

        protected int selected
        This may be set during the standard calling sequence to record which method was invoked by a client. It is only safe to do this between the join and fork elements of that sequence. Either all the CALL channel methods should do this or none - in the latter case, its default value remains as zero. Its value is returned to a server as the result the server's invocation of accept.
    • Constructor Detail

      • One2OneCallChannel

        public One2OneCallChannel()
    • Method Detail

      • accept

        public int accept​(CSProcess server)
        This is invoked by a server when it commits to accepting a CALL from a client. The parameter supplied must be a reference to this server - see the example above. It will not complete until a CALL has been made. If the derived CALL channel has set the selected field in the way defined by the standard calling sequence, the value returned by this method will indicate which method was called.
        Specified by:
        accept in interface ChannelAccept
        Parameters:
        server - the server process receiving the CALL.
      • join

        protected void join()
        This is invoked by a client during the standard calling sequence. It will not complete until a server invokes an accept on this channel. In turn, that accept will not complete until the client invokes a fork, after having made its CALL on the server.
      • fork

        protected void fork()
        This is invoked by a client during the standard calling sequence. A server must have invoked an accept for the client to have got this far in the sequence - see the join. This call unblocks that accept, releasing the server and client to resume separate lives.