Class BambooRunnables

java.lang.Object
com.atlassian.bamboo.utils.BambooRunnables

public class BambooRunnables extends Object
  • Method Details

    • asJavaRunnable

      public static <V> BambooRunnables.RunnableFromCallable<V> asJavaRunnable(Callable<V> callable)
    • asBambooRunnable

      public static <V> BambooRunnables.BambooRunnableFromCallable<V> asBambooRunnable(Callable<V> callable)
    • from

      public static BambooRunnables.NotThrowing from(Runnable runnable)
    • runOnce

      public static Runnable runOnce(Runnable code)
      Will run runnable only once. Next calls to run will run nothing.
      Parameters:
      code -
      Returns:
    • runUnchecked

      public static void runUnchecked(BambooRunnables.ThrowingX<? extends Exception,? extends Exception,? extends Exception> throwingRunnable)
    • retryOnCondition

      public static void retryOnCondition(Runnable runnable, BooleanSupplier shouldRetry, int maxRetries)
      Repeatedly executes the given Runnable until the BooleanSupplier shouldRetry supplier succeeds or the maximum number of retries is reached. The BooleanSupplier is checked after Runnable execution so there is always at least one execution.
      Parameters:
      runnable - the Runnable to be executed
      shouldRetry - a BooleanSupplier that returns true if the retry should continue, false otherwise
      maxRetries - the maximum number of retries
      Throws:
      RuntimeException - if the maximum number of retries is reached and the Runnable still fails