Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
fix: deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Mar 17, 2021
1 parent 5da364a commit a42ea60
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@

/**
* Same as {@link ResultRetryAlgorithmWithContext}, but without methods that accept a {@link
* RetryingContext}.
* RetryingContext}. Use {@link ResultRetryAlgorithmWithContext} instead of this interface when
* possible.
*/
public interface ResultRetryAlgorithm<ResponseT> {
/**
* Same as {@link ResultRetryAlgorithmWithContext#createNextAttempt(RetryingContext, Throwable,
* Object, TimedAttemptSettings)}, but without a {@link RetryingContext}.
*
* @deprecated use {@link ResultRetryAlgorithmWithContext#createNextAttempt(RetryingContext,
* Throwable, Object, TimedAttemptSettings)} instead
* <p>Use {@link ResultRetryAlgorithmWithContext#createNextAttempt(RetryingContext, Throwable,
* Object, TimedAttemptSettings)} instead of this method when possible.
*/
@Deprecated
TimedAttemptSettings createNextAttempt(
Throwable prevThrowable, ResponseT prevResponse, TimedAttemptSettings prevSettings);

/**
* Same as {@link ResultRetryAlgorithmWithContext#shouldRetry(Throwable, Object)}, but without a
* {@link RetryingContext}.
*
* @deprecated use {@link ResultRetryAlgorithmWithContext#shouldRetry(RetryingContext, Throwable,
* Object)} instead
* <p>Use {@link ResultRetryAlgorithmWithContext#shouldRetry(RetryingContext, Throwable, Object)}
* instead of this method when possible.
*/
boolean shouldRetry(Throwable prevThrowable, ResponseT prevResponse) throws CancellationException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public RetryAlgorithm(
* Creates a first attempt {@link TimedAttemptSettings}.
*
* @return first attempt settings
* @deprecated use {@link #createFirstAttempt(RetryingContext)} instead
*/
@Deprecated
public TimedAttemptSettings createFirstAttempt() {
return createFirstAttempt(null);
}
Expand All @@ -105,7 +107,6 @@ public TimedAttemptSettings createFirstAttempt() {
* RetrySettings}
* @return first attempt settings
*/
@SuppressWarnings("deprecation")
public TimedAttemptSettings createFirstAttempt(RetryingContext context) {
if (timedAlgorithmWithContext != null && context != null) {
return timedAlgorithmWithContext.createFirstAttempt(context);
Expand All @@ -123,7 +124,10 @@ public TimedAttemptSettings createFirstAttempt(RetryingContext context) {
* thrown instead
* @param previousSettings previous attempt settings
* @return next attempt settings, can be {@code null}, if no there should be no new attempt
* @deprecated use {@link #createNextAttempt(RetryingContext, Throwable, Object,
* TimedAttemptSettings)} instead
*/
@Deprecated
public TimedAttemptSettings createNextAttempt(
Throwable previousThrowable,
ResponseT previousResponse,
Expand Down Expand Up @@ -164,7 +168,6 @@ public TimedAttemptSettings createNextAttempt(
return newSettings;
}

@SuppressWarnings("deprecation")
private TimedAttemptSettings createNextAttemptBasedOnResult(
RetryingContext context,
Throwable previousThrowable,
Expand All @@ -178,7 +181,6 @@ private TimedAttemptSettings createNextAttemptBasedOnResult(
.createNextAttempt(previousThrowable, previousResponse, previousSettings);
}

@SuppressWarnings("deprecation")
private TimedAttemptSettings createNextAttemptBasedOnTiming(
RetryingContext context, TimedAttemptSettings previousSettings) {
if (timedAlgorithmWithContext != null && context != null) {
Expand All @@ -198,7 +200,10 @@ private TimedAttemptSettings createNextAttemptBasedOnTiming(
* accepted
* @throws CancellationException if the retrying process should be canceled
* @return {@code true} if another attempt should be made, or {@code false} otherwise
* @deprecated use {@link #shouldRetry(RetryingContext, Throwable, Object, TimedAttemptSettings)}
* instead
*/
@Deprecated
public boolean shouldRetry(
Throwable previousThrowable,
ResponseT previousResponse,
Expand Down Expand Up @@ -231,7 +236,6 @@ public boolean shouldRetry(
&& shouldRetryBasedOnTiming(context, nextAttemptSettings);
}

@SuppressWarnings("deprecation")
boolean shouldRetryBasedOnResult(
RetryingContext context, Throwable previousThrowable, ResponseT previousResponse) {
if (resultAlgorithmWithContext != null && context != null) {
Expand All @@ -240,7 +244,6 @@ boolean shouldRetryBasedOnResult(
return getResultAlgorithm().shouldRetry(previousThrowable, previousResponse);
}

@SuppressWarnings("deprecation")
private boolean shouldRetryBasedOnTiming(
RetryingContext context, TimedAttemptSettings nextAttemptSettings) {
if (nextAttemptSettings == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,35 @@

/**
* Same as {@link TimedRetryAlgorithmWithContext}, but without methods that accept a {@link
* RetryingContext}.
* RetryingContext}. Use {@link TimedRetryAlgorithmWithContext} instead of this interface when
* possible.
*/
public interface TimedRetryAlgorithm {

/**
* Same as {@link TimedRetryAlgorithmWithContext#createFirstAttempt(RetryingContext)}, but without
* a {@link RetryingContext}.
*
* @deprecated use {@link TimedRetryAlgorithmWithContext#createFirstAttempt(RetryingContext)}
* instead
* <p>Use {@link TimedRetryAlgorithmWithContext#createFirstAttempt(RetryingContext)} instead of
* this method when possible.
*/
TimedAttemptSettings createFirstAttempt();

/**
* Same as {@link TimedRetryAlgorithmWithContext#createNextAttempt(RetryingContext,
* TimedAttemptSettings)}, but without a {@link RetryingContext}.
*
* @deprecated use {@link TimedRetryAlgorithmWithContext#createNextAttempt(RetryingContext,
* TimedAttemptSettings)} instead
* <p>Use {@link TimedRetryAlgorithmWithContext#createNextAttempt(RetryingContext,
* TimedAttemptSettings)} instead of this method when possible.
*/
@Deprecated
TimedAttemptSettings createNextAttempt(TimedAttemptSettings prevSettings);

/**
* Same as {@link TimedRetryAlgorithmWithContext#shouldRetry(RetryingContext,
* TimedAttemptSettings)}, but without a {@link RetryingContext}.
*
* @deprecated use {@link TimedRetryAlgorithmWithContext#shouldRetry(RetryingContext,
* TimedAttemptSettings)} instead
* <p>Use {@link TimedRetryAlgorithmWithContext#shouldRetry(RetryingContext,
* TimedAttemptSettings)} instead of this method when possible.
*/
@Deprecated
boolean shouldRetry(TimedAttemptSettings nextAttemptSettings) throws CancellationException;
}

0 comments on commit a42ea60

Please sign in to comment.