Created
February 23, 2018 18:44
-
-
Save borislopezaraoz/abf67e7738bbc091bbea1154b3b8cf52 to your computer and use it in GitHub Desktop.
jhalterman/failsafe in Groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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