Package hudson.util

Class Retrier<V>

java.lang.Object
hudson.util.Retrier<V>
Type Parameters:
V - The return type of the action to perform.

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class Retrier<V> extends Object
This class implements a process of doing some action repeatedly synchronously until it is performed successfully. You can set the number of attempts, the action to perform, the milliseconds to wait for, the definition of success, the exceptions that are considered as a failed action, but not an unexpected exception in the action and also the listener to manage the expected exceptions happened, just in case it is helpful.
  • Method Details

    • start

      @CheckForNull public V start() throws Exception
      Start to do retries to perform the set action.
      Returns:
      the result of the action, it could be null if there was an exception or if the action itself returns null
      Throws:
      Exception - If a unallowed exception is raised during the action