Skip to content

Instantly share code, notes, and snippets.

@borislopezaraoz
Created February 23, 2018 18:44
Show Gist options
  • Select an option

  • Save borislopezaraoz/abf67e7738bbc091bbea1154b3b8cf52 to your computer and use it in GitHub Desktop.

Select an option

Save borislopezaraoz/abf67e7738bbc091bbea1154b3b8cf52 to your computer and use it in GitHub Desktop.
jhalterman/failsafe in Groovy
@Grab('net.jodah:failsafe:1.0.5')
import java.util.concurrent.TimeUnit
import net.jodah.failsafe.RetryPolicy
import net.jodah.failsafe.Failsafe
RetryPolicy retryPolicy = new RetryPolicy()
.retryWhen(false)
.withMaxRetries(3)
.withDelay(3, TimeUnit.SECONDS)
Closure closure = {
println 'hello'
return false
}
Failsafe.with(retryPolicy).get(closure)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment