Class NonblockingSaslHandler

java.lang.Object
org.apache.thrift.transport.sasl.NonblockingSaslHandler

public class NonblockingSaslHandler extends Object
State machine managing one sasl connection in a nonblocking way.
  • Constructor Details

  • Method Details

    • getCurrentPhase

      public NonblockingSaslHandler.Phase getCurrentPhase()
      Get current phase of the state machine.
      Returns:
      current phase.
    • 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 SaslServer getSaslServer()
      Returns:
      SaslServer instance
    • isCurrentPhaseDone

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

      public void runCurrentPhase()
      Run state machine.
      Throws:
      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:
      IllegalStateException - if is called in an irrelevant phase.
    • handleWrite

      public void handleWrite()
      Similiar to handleRead. But it is for write ops.
      Throws:
      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:
      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.