Class NonblockingSaslHandler


  • public class NonblockingSaslHandler
    extends java.lang.Object
    State machine managing one sasl connection in a nonblocking way.
    • Method Detail

      • getNextPhase

        public NonblockingSaslHandler.Phase getNextPhase()
        Get next phase of the state machine. It is different from current phase iff current phase is done (and next phase not yet started).
        Returns:
        next phase.
      • getUnderlyingTransport

        public TNonblockingTransport getUnderlyingTransport()
        Returns:
        underlying nonblocking socket
      • getSaslServer

        public javax.security.sasl.SaslServer getSaslServer()
        Returns:
        SaslServer instance
      • isCurrentPhaseDone

        public boolean isCurrentPhaseDone()
        Returns:
        true if current phase is done.
      • runCurrentPhase

        public void runCurrentPhase()
        Run state machine.
        Throws:
        java.lang.IllegalStateException - if current state is already done.
      • handleRead

        public void handleRead()
        When current phase is intrested in read selection, calling this will run the current phase and its following phases if the following ones are interested to read, until there is nothing available in the underlying transport.
        Throws:
        java.lang.IllegalStateException - if is called in an irrelevant phase.
      • handleWrite

        public void handleWrite()
        Similiar to handleRead. But it is for write ops.
        Throws:
        java.lang.IllegalStateException - if it is called in an irrelevant phase.
      • stepToNextPhase

        public void stepToNextPhase()
        When current phase is finished, it's expected to call this method first before running the state machine again. By calling this, "next phase" is marked as started (and not done), thus is ready to run.
        Throws:
        java.lang.IllegalArgumentException - if current phase is not yet done.
      • close

        public void close()
        Release all the resources managed by this state machine (connection, selection and sasl server). To avoid being blocked, this should be invoked in the network thread that manages the selector.