Skip to content

roshan/groundhog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Groundhog Build Status

Simple retry mechanism for Java Callables.

Maven

<dependency>
  <groupId>com.arjie.groundhog</groupId>
  <artifactId>groundhog</artifactId>
  <version>0.9.0</version>
</dependency>

Usage

Add the JAR to your classpath and then use with

RetryBuilders.basic()
    .withTryStrategy(new MaxTries.Builder<>()
      .setMaxTries(maxTries)
      .addExceptionToRetryOn(IOException.class)
      .build())
    .withDelayStrategy(new FixedDelay<>(waitMillisBetweenTries));

or with the two convenience constructors:

RetryBuilders.fixedTriesFixedDelay(maxTries, waitMillisBetweenTries).build(callable)
RetryBuilders.fixedTriesExponentialBackoff(maxTries, delayFactor, initialDelayInMillis).build(callable);

Use RetryBuilder#annotate instead of RetryBuilder#build to get the final state as well as the finally returned value.

About

Simple retry mechanism for Java Callables

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages