Interface CompletionPolicy

    • Method Detail

      • isComplete

        boolean isComplete​(RepeatContext context,
                           RepeatStatus result)
        Determine whether a batch is complete given the latest result from the callback. If this method returns true then isComplete(RepeatContext) should also (but not necessarily vice versa, since the answer here depends on the result).
        Parameters:
        context - the current batch context.
        result - the result of the latest batch item processing.
        Returns:
        true if the batch should terminate.
        See Also:
        isComplete(RepeatContext)
      • isComplete

        boolean isComplete​(RepeatContext context)
        Allow policy to signal completion according to internal state, without having to wait for the callback to complete.
        Parameters:
        context - the current batch context.
        Returns:
        true if the batch should terminate.
      • start

        RepeatContext start​(RepeatContext parent)
        Create a new context for the execution of a batch. N.B. implementations should not return the parent from this method - they must create a new context to meet the specific needs of the policy. The best way to do this might be to override an existing implementation and use the RepeatContext to store state in its attributes.
        Parameters:
        parent - the current context if one is already in progress.
        Returns:
        a context object that can be used by the implementation to store internal state for a batch.
      • update

        void update​(RepeatContext context)
        Give implementations the opportunity to update the state of the current batch. Will be called once per callback, after it has been launched, but not necessarily after it completes (if the batch is asynchronous).
        Parameters:
        context - the value returned by start.