Class NextAction

    • Constructor Detail

      • NextAction

        public NextAction()
    • Method Detail

      • returnWith

        public void returnWith​(Packet response)
        Indicates that the next action is to flip the processing direction and starts response processing.
      • throwExceptionAbortResponse

        public void throwExceptionAbortResponse​(Throwable t)
        Indicates that the next action is to abort the processResponse chain because of an exception. How that exception is processed is not defined.
        Parameters:
        t - Either RuntimeException or Error
      • abortResponse

        public void abortResponse​(Packet response)
        Indicates that the next action is to abort the processResponse chain because of some non-exception condition.
        Parameters:
        response - The response that is being aborted
      • invokeAsync

        public void invokeAsync​(Tube next,
                                Packet p)
        Indicates that the next action is to invoke the next tube in the tubeline async from the thread that started the tubeline. Only fibers that were started using startSync should use this next action kind.
        Parameters:
        next - The next tube in the tubeline
        p - The request to pass to the next tube
      • suspend

        public void suspend()
        Deprecated.
        Use variants that pass Runnable
        Indicates that the fiber should be suspended. Once resumed, return the response processing.
      • suspend

        public void suspend​(Runnable onExitRunnable)
        Indicates that the fiber should be suspended. Once the current Thread exits the fiber's control loop, the onExitRunnable will be invoked. This Runnable may call Fiber.resume(Packet); however it is still guaranteed that the current Thread will return control, therefore, further processing will be handled on a Thread from the Executor. For synchronous cases, the Thread invoking this fiber cannot return until fiber processing is complete; therefore, the guarantee is only that the onExitRunnable will be invoked prior to completing the suspension.
        Since:
        2.2.7
      • suspend

        public void suspend​(Tube next,
                            Runnable onExitRunnable)
        Indicates that the fiber should be suspended. Once the current Thread exits the fiber's control loop, the onExitRunnable will be invoked. This Runnable may call Fiber.resume(Packet); however it is still guaranteed that the current fiber will return control, therefore, further processing will be handled on a Thread from the Executor. For synchronous cases, the Thread invoking this fiber cannot return until fiber processing is complete; therefore, the guarantee is only that the onExitRunnable will be invoked prior to completing the suspension.

        Once resumed, resume with the Tube.processRequest(Packet) on the given next tube.

        Since:
        2.2.7
      • getNext

        public Tube getNext()
        Returns the next tube
        Returns:
        Next tube
      • setNext

        public void setNext​(Tube next)
        Sets the next tube
        Parameters:
        next - Next tube
      • getPacket

        public Packet getPacket()
        Returns the last Packet
        Returns:
        Packet
      • getThrowable

        public Throwable getThrowable()
        Returns the Throwable generated by the last Tube
        Returns:
        the Throwable
      • toString

        public String toString()
        Dumps the contents to assist debugging.
        Overrides:
        toString in class Object
      • getKindString

        public String getKindString()
        Returns kind in a human readable string, to assist debugging.