Class TCPTransport

    • Constructor Detail

      • TCPTransport

        public TCPTransport​(ContextImpl context,
                            TransportClient client,
                            ResponseHandlers.ResponseHandler responseHandler,
                            java.nio.channels.SocketChannel channel,
                            short remoteTransportRevision,
                            int priority)
        Constructs a new object for managing the TCP connection with a remote server.
        Parameters:
        context - the CA context in which the communication takes place.
        responseHandler - reference to an object which will manage the handling of the server responses.
        client - the client.
        channel - socket through which communication will flow.
        remoteTransportRevision - the CA transport revision (a constant) to be used in communication.
        priority - the CA message priority.
    • Method Detail

      • close

        public void close​(boolean remotelyClosed)
        Close connection.
        Parameters:
        remotelyClosed - flag indicating weather the socket has already been remotely closed
      • acquire

        public boolean acquire​(TransportClient client)
        Acquires transport.
        Parameters:
        client - client (channel) acquiring the transport
        Returns:
        true if transport was granted, false otherwise.
      • release

        public void release​(TransportClient client)
        Releases transport.
        Parameters:
        client - client (channel) releasing the transport
      • getMinorRevision

        public short getMinorRevision()
        Description copied from interface: Transport
        Transport protocol minor revision.
        Specified by:
        getMinorRevision in interface Transport
        Returns:
        protocol minor revision.
      • handleEvent

        public void handleEvent​(java.nio.channels.SelectionKey key)
        Handle IO event.
        Specified by:
        handleEvent in interface ReactorHandler
        Parameters:
        key - key to be processed.
      • processRead

        protected void processRead()
        Process input obtained via channel (read) IO event. Also handles subscription flow control.
      • processReadBuffer

        protected void processReadBuffer()
        Process input from receive buffer
      • processWrite

        protected void processWrite()
        Process output (write) IO event.
      • disableFlowControl

        protected void disableFlowControl()
        Disable flow control (enables events).
      • enableFlowControl

        protected void enableFlowControl()
        Enable flow control (disables events).
      • getContext

        public ContextImpl getContext()
        Description copied from interface: Transport
        Get context transport is living in.
        Specified by:
        getContext in interface Transport
        Returns:
        context transport is living in.
      • acquireSendBuffer

        public java.nio.ByteBuffer acquireSendBuffer​(int requiredSize)
        Specified by:
        acquireSendBuffer in interface Transport
      • releaseSendBuffer

        public void releaseSendBuffer​(boolean ignore,
                                      boolean flush)
        Specified by:
        releaseSendBuffer in interface Transport
      • flush

        public void flush()
        Specified by:
        flush in interface Transport
      • flush

        protected void flush​(boolean wait)
      • getRemoteAddress

        public java.net.InetSocketAddress getRemoteAddress()
        Description copied from interface: Transport
        Get remote address.
        Specified by:
        getRemoteAddress in interface Transport
        Returns:
        remote address.
      • run

        public void run()
        Echo timer.
        Specified by:
        run in interface java.lang.Runnable