Class ContinuationStackManager


  • public class ContinuationStackManager
    extends Object
    This is the utility class which manages ContinuationState Stack.

    All operations for the stack done by mediators are done through this manager class in order to easily control the operations from a central place.

    • Constructor Detail

      • ContinuationStackManager

        public ContinuationStackManager()
    • Method Detail

      • addSeqContinuationState

        public static void addSeqContinuationState​(MessageContext synCtx,
                                                   String seqName,
                                                   SequenceType seqType)
        Add new SeqContinuationState to the stack. This should be done when branching to a new Sequence
        Parameters:
        synCtx - Message Context
        seqName - Name of the branching sequence
        seqType - Sequence Type
      • isSkipSeqContinuationStateAddition

        public static boolean isSkipSeqContinuationStateAddition​(MessageContext synCtx)
        Check whether sequence continuation state addition need to be skipped
        Parameters:
        synCtx - message context
        Returns:
        whether sequence continuation state addition need to be skipped
      • removeSeqContinuationState

        public static void removeSeqContinuationState​(MessageContext synCtx,
                                                      SequenceType seqType)
        Remove top SeqContinuationState from the stack. This should be done when returning from a Sequence branch.
        Parameters:
        synCtx - Message Context
      • updateSeqContinuationState

        public static void updateSeqContinuationState​(MessageContext synCtx,
                                                      int position)
        Update SeqContinuationState with the current mediator position in the sequence. SeqContinuationState should be updated when branching to a new flow using a FlowContinuableMediator
        Parameters:
        synCtx - Message Context
      • addReliantContinuationState

        public static void addReliantContinuationState​(MessageContext synCtx,
                                                       int subBranch,
                                                       int position)
        Add a ReliantContinuationState to the top SeqContinuationState in the stack. This should be done when branching to a sub branch using FlowContinuableMediators except Sequence Mediator
        Parameters:
        synCtx - Message Context
        subBranch - Sub branch id
      • removeReliantContinuationState

        public static void removeReliantContinuationState​(MessageContext synCtx)
        Remove a ReliantContinuationState from the top SeqContinuationState in the stack. This should be done when returning back from a sub branch of a FlowContinuableMediator.
        Parameters:
        synCtx - MessageContext
      • getClonedSeqContinuationState

        public static SeqContinuationState getClonedSeqContinuationState​(SeqContinuationState oriSeqContinuationState)
        Get a clone of a SeqContinuationState
        Parameters:
        oriSeqContinuationState - original SeqContinuationState
        Returns:
        cloned SeqContinuationState
      • clearStack

        public static void clearStack​(MessageContext synCtx)
        Remove all ContinuationStates from ContinuationState Stack
        Parameters:
        synCtx - MessageContext
      • peakContinuationStateStack

        public static ContinuationState peakContinuationStateStack​(MessageContext synCtx)
        Peek from Continuation Stack
        Returns:
        ContinuationState
      • popContinuationStateStack

        public static void popContinuationStateStack​(MessageContext synCtx)
        Pop from Continuation Stack
      • retrieveSequence

        public static SequenceMediator retrieveSequence​(MessageContext synCtx,
                                                        SeqContinuationState seqContState)
        Retrieve the sequence from Continuation state which message should be injected to.
        Parameters:
        seqContState - SeqContinuationState which contain the sequence information
        synCtx - message context
        Returns:
        sequence which message should be injected to
      • pushFaultHandler

        public static void pushFaultHandler​(MessageContext synCtx,
                                            SeqContinuationState seqContState)
        Push fault handler for the received continuation call response.
        Parameters:
        seqContState - SeqContinuationState which contain the sequence information
        synCtx - message context