Class CASTransport

    • Field Detail

      • responseHandler

        protected ResponseHandler responseHandler
        CAS reponse handler.
    • Constructor Detail

      • CASTransport

        public CASTransport​(CAContext context,
                            SocketChannel channel)
        Parameters:
        context -
        channel -
    • Method Detail

      • close

        public void close​(boolean forced)
        Close connection.
        Parameters:
        forced - flag indicating if forced (e.g. forced disconnect) is required
      • setMinorRevision

        public void setMinorRevision​(short minorRevision)
        Set minor revision number.
        Parameters:
        minorRevision - minor revision number.
      • processRead

        protected void processRead()
        Process input (read) IO event.
      • processWrite

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

        public void send​(ByteBuffer buffer)
                  throws IOException
        Send a buffer through the transport. NOTE: TCP sent buffer/sending has to be synchronized.
        Parameters:
        buffer - buffer to be sent
        Throws:
        IOException
      • flush

        public boolean flush()
        Flush send buffer. ... by enabling SelectionKey.OP_WRITE and process in reactor.
        Specified by:
        flush in interface Transport
        Returns:
        true on success, false on failure.
        See Also:
        Transport.flush()
      • flushInternal

        public boolean flushInternal()
        Flush send buffer (blocks until flushed).
        Returns:
        success flag.
        See Also:
        Transport.flush()
      • setPriority

        public void setPriority​(short priority)
        Set transport priority.
      • getClientHostname

        public String getClientHostname()
        Get client hostname.
        Returns:
        client hostname, null if unset.
      • getClientUsername

        public String getClientUsername()
        Get client username.
        Returns:
        client username, null if unset.
      • setClientHostname

        public void setClientHostname​(String clientHostname)
        Set client hostname.
        Parameters:
        clientHostname - client hostname.
      • setClientUsername

        public void setClientUsername​(String clientUsername)
        Set client username.
        Parameters:
        clientUsername - client username.
      • preallocateChannelSID

        public int preallocateChannelSID()
        Preallocate new channel SID.
        Returns:
        new channel server id (SID).
      • depreallocateChannelSID

        public void depreallocateChannelSID​(int sid)
        De-preallocate new channel SID.
        Parameters:
        sid - preallocated channel SID.
      • registerChannel

        public void registerChannel​(int sid,
                                    ServerChannel channel)
        Register a new channel.
        Parameters:
        sid - preallocated channel SID.
        channel - channel to register.
      • unregisterChannel

        public void unregisterChannel​(int sid)
        Unregister a new channel (and deallocates its handle).
        Parameters:
        sid - SID
      • getChannel

        public ServerChannel getChannel​(int sid)
        Get channel by its SID.
        Parameters:
        sid - channel SID
        Returns:
        channel with given SID, null otherwise
      • getChannelAndVerifyRequest

        public ServerChannel getChannelAndVerifyRequest​(int sid,
                                                        short dataType,
                                                        int dataCount)
                                                 throws CAStatusException
        Get channel by its SID and do some additional checks.
        Parameters:
        sid - channel SID
        Returns:
        channel with given SID, exception with status is thrown otherwise
        Throws:
        CAStatusException
      • getChannelCount

        public int getChannelCount()
        Get channel count.
        Returns:
        channel count.
      • eventsOff

        public void eventsOff()
        Turn event dispatching off.
      • eventsOn

        public void eventsOn()
        Turn event dispatching on.
      • hasReplaceEventPolicy

        public final boolean hasReplaceEventPolicy()
        Get replace event policy flag.
        Returns:
        replace event policy flag.
      • processEvents

        public boolean processEvents​(Runnable event)
        Process event.
        Parameters:
        event - event to be processed.
        Returns:
        success flag.