guava-retrying icon indicating copy to clipboard operation
guava-retrying copied to clipboard

Make ExceptionAttempt and ResultAttempt public

Open stevie400 opened this issue 8 years ago • 1 comments
trafficstars

I'm in (much belated) process of upgrading my company's codebase to 2.0.0. In doing so, I found that I had to copy-past these class definitions into our code in order to use them, so I thought that they'd be useful to expose.

I think that it could also make sense to demote these back to static classes and expose via factory methods:

public class Attempts {
  public static <R> Attempt<R> exceptionAttempt(Throwable cause, long attemptNumber, long delaySinceFirstAttempt) {
    return new ExceptionAttempt<R>(cause, attemptNumber, delaySinceFirstAttempt);
  }

  public static <R> Attempt<R> resultAttempt(R result, long attemptNumber, long delaySinceFirstAttempt) {
    return new ResultAttempt<R>(result, attemptNumber, delaySinceFirstAttempt);
  }
}

Let me know what you think: I'll happily iterate on this as desired!

@rholder

stevie400 avatar Jul 24 '17 21:07 stevie400

I think the build is failing trying to run under Guava 21.

stevie400 avatar Jul 24 '17 21:07 stevie400