Package com.atlassian.bamboo.utils
Class BambooRunnables
java.lang.Object
com.atlassian.bamboo.utils.BambooRunnables
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic classstatic interfaceBambooRunnables.Throwing<E1 extends Throwable>static interfaceBambooRunnables.Throwing1<E1 extends Throwable>static interfaceBambooRunnables.Throwing2<E1 extends Throwable,E2 extends Throwable> static interface -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> BambooRunnables.BambooRunnableFromCallable<V> asBambooRunnable(Callable<V> callable) static <V> BambooRunnables.RunnableFromCallable<V> asJavaRunnable(Callable<V> callable) static BambooRunnables.NotThrowingstatic voidretryOnCondition(Runnable runnable, BooleanSupplier shouldRetry, int maxRetries) Repeatedly executes the givenRunnableuntil theBooleanSuppliershouldRetry supplier succeeds or the maximum number of retries is reached.static RunnableWill run runnable only once.static voidrunUnchecked(BambooRunnables.ThrowingX<? extends Exception, ? extends Exception, ? extends Exception> throwingRunnable)
-
Method Details
-
asJavaRunnable
-
asBambooRunnable
public static <V> BambooRunnables.BambooRunnableFromCallable<V> asBambooRunnable(Callable<V> callable) -
from
-
runOnce
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
Repeatedly executes the givenRunnableuntil theBooleanSuppliershouldRetry supplier succeeds or the maximum number of retries is reached. TheBooleanSupplieris checked afterRunnableexecution so there is always at least one execution.- Parameters:
runnable- theRunnableto be executedshouldRetry- aBooleanSupplierthat returnstrueif the retry should continue,falseotherwisemaxRetries- the maximum number of retries- Throws:
RuntimeException- if the maximum number of retries is reached and theRunnablestill fails
-