Class TryRepeatedly<V>

  • All Implemented Interfaces:
    com.google.common.util.concurrent.ListenableFuture<V>, Future<V>

    public abstract class TryRepeatedly<V>
    extends com.google.common.util.concurrent.AbstractFuture<V>
    ListenableFuture that promises a value that needs to be periodically tried. Specialized for use from Pickle.rehydrate(FlowExecutionOwner).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TryRepeatedly​(int delay)  
      protected TryRepeatedly​(int delay, int initialDelay)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancel​(boolean mayInterruptIfRunning)  
      protected org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner getOwner()
      Override to supply the owner passed to Pickle.rehydrate(FlowExecutionOwner).
      protected void printWaitingMessage​(TaskListener listener)
      Assuming getOwner() has been overridden, override to print a message to the build log explaining why the pickle is still unloadable.
      protected abstract V tryResolve()
      This method is called periodically to attempt to resolve the value that this future promises.
      • Methods inherited from class com.google.common.util.concurrent.AbstractFuture

        addListener, afterDone, get, get, interruptTask, isCancelled, isDone, pendingToString, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterrupted
    • Constructor Detail

      • TryRepeatedly

        protected TryRepeatedly​(int delay)
      • TryRepeatedly

        protected TryRepeatedly​(int delay,
                                int initialDelay)
    • Method Detail

      • getOwner

        @NonNull
        protected org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner getOwner()
        Override to supply the owner passed to Pickle.rehydrate(FlowExecutionOwner).
      • printWaitingMessage

        protected void printWaitingMessage​(@NonNull
                                           TaskListener listener)
        Assuming getOwner() has been overridden, override to print a message to the build log explaining why the pickle is still unloadable. Could use ModelHyperlinkNote etc.
      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface Future<V>
        Overrides:
        cancel in class com.google.common.util.concurrent.AbstractFuture<V>
      • tryResolve

        @CheckForNull
        protected abstract V tryResolve()
                                 throws Exception
        This method is called periodically to attempt to resolve the value that this future promises.
        Returns:
        null to retry this at a later moment.
        Throws:
        Exception - Any exception thrown will cause the future to fail.