Class SynchronousNonBlockingStepExecution<T>

    • Constructor Detail

      • SynchronousNonBlockingStepExecution

        protected SynchronousNonBlockingStepExecution​(@NonNull
                                                      StepContext context)
    • Method Detail

      • run

        protected abstract T run()
                          throws Exception
        Meat of the execution. When this method returns, a step execution is over.
        Throws:
        Exception
      • start

        public final boolean start()
                            throws Exception
        Description copied from class: StepExecution
        Start execution of something and report the end result back to the given callback.

        Arguments are passed when instantiating steps.

        This method will run in the CPS VM thread and as such should not perform I/O or block. Use SynchronousNonBlockingStepExecution or GeneralNonBlockingStepExecution as needed.

        Specified by:
        start in class StepExecution
        Returns:
        true if the execution of this step has synchronously completed before this method returns. It is the callee's responsibility to set the return value via StepContext.onSuccess(Object) or FutureCallback.onFailure(Throwable). false if the asynchronous execution has started and that StepContext will be notified when the result comes in. (Note that the nature of asynchrony is such that it is possible for the StepContext to be already notified before this method returns.)
        Throws:
        Exception - if any exception is thrown, Step is assumed to have completed abnormally synchronously (as if FutureCallback.onFailure(java.lang.Throwable) is called and the method returned true.)
      • stop

        public void stop​(Throwable cause)
                  throws Exception
        If the computation is going synchronously, try to cancel that.
        Overrides:
        stop in class StepExecution
        Parameters:
        cause - Contextual information that lets the step know what resulted in stopping an executing step, passed in the hope that this will assist diagnostics.
        Throws:
        Exception
      • getStatus

        @NonNull
        public String getStatus()
        Description copied from class: StepExecution
        May be overridden to provide specific information about what a step is currently doing, for diagnostic purposes. Typical format should be a short, lowercase phrase. It should not be localized as this is intended for use by developers as well as users. May include technical details about Jenkins internals if relevant.
        Overrides:
        getStatus in class StepExecution
        Returns:
        current status, or null if unimplemented
        See Also:
        StepExecution.getStatusBounded(long, java.util.concurrent.TimeUnit)