
com.sirolf2009.util.retry.Retry.xtend Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of util Show documentation
Show all versions of util Show documentation
A collection of my common utilities
The newest version!
package com.sirolf2009.util.retry
import java.util.function.Supplier
class Retry {
public static RetryStrategy defaultStrategy = new SimpleRetryStrategy(3)
def static void retry(Runnable runnable) {
retry(new Supplier() {
override Void get() {
runnable.run()
return null;
}
})
}
def static RetryResult retry(Supplier supplier) {
return retry(supplier, defaultStrategy)
}
def static RetryResult retry(Supplier supplier, int attempts) {
return retry(supplier, new SimpleRetryStrategy(attempts))
}
def static RetryResult retry(Supplier supplier, RetryStrategy strategy) {
return strategy.run(supplier)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy