diff --git a/gax/src/main/java/com/google/api/gax/retrying/ResultRetryAlgorithm.java b/gax/src/main/java/com/google/api/gax/retrying/ResultRetryAlgorithm.java index 00f72bff4..53363f37a 100644 --- a/gax/src/main/java/com/google/api/gax/retrying/ResultRetryAlgorithm.java +++ b/gax/src/main/java/com/google/api/gax/retrying/ResultRetryAlgorithm.java @@ -33,17 +33,17 @@ /** * 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 { /** * Same as {@link ResultRetryAlgorithmWithContext#createNextAttempt(RetryingContext, Throwable, * Object, TimedAttemptSettings)}, but without a {@link RetryingContext}. * - * @deprecated use {@link ResultRetryAlgorithmWithContext#createNextAttempt(RetryingContext, - * Throwable, Object, TimedAttemptSettings)} instead + *

Use {@link ResultRetryAlgorithmWithContext#createNextAttempt(RetryingContext, Throwable, + * Object, TimedAttemptSettings)} instead of this method when possible. */ - @Deprecated TimedAttemptSettings createNextAttempt( Throwable prevThrowable, ResponseT prevResponse, TimedAttemptSettings prevSettings); @@ -51,8 +51,8 @@ TimedAttemptSettings createNextAttempt( * Same as {@link ResultRetryAlgorithmWithContext#shouldRetry(Throwable, Object)}, but without a * {@link RetryingContext}. * - * @deprecated use {@link ResultRetryAlgorithmWithContext#shouldRetry(RetryingContext, Throwable, - * Object)} instead + *

Use {@link ResultRetryAlgorithmWithContext#shouldRetry(RetryingContext, Throwable, Object)} + * instead of this method when possible. */ boolean shouldRetry(Throwable prevThrowable, ResponseT prevResponse) throws CancellationException; } diff --git a/gax/src/main/java/com/google/api/gax/retrying/RetryAlgorithm.java b/gax/src/main/java/com/google/api/gax/retrying/RetryAlgorithm.java index 4feb442b8..16d60d148 100644 --- a/gax/src/main/java/com/google/api/gax/retrying/RetryAlgorithm.java +++ b/gax/src/main/java/com/google/api/gax/retrying/RetryAlgorithm.java @@ -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); } @@ -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); @@ -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, @@ -164,7 +168,6 @@ public TimedAttemptSettings createNextAttempt( return newSettings; } - @SuppressWarnings("deprecation") private TimedAttemptSettings createNextAttemptBasedOnResult( RetryingContext context, Throwable previousThrowable, @@ -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) { @@ -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, @@ -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) { @@ -240,7 +244,6 @@ boolean shouldRetryBasedOnResult( return getResultAlgorithm().shouldRetry(previousThrowable, previousResponse); } - @SuppressWarnings("deprecation") private boolean shouldRetryBasedOnTiming( RetryingContext context, TimedAttemptSettings nextAttemptSettings) { if (nextAttemptSettings == null) { diff --git a/gax/src/main/java/com/google/api/gax/retrying/TimedRetryAlgorithm.java b/gax/src/main/java/com/google/api/gax/retrying/TimedRetryAlgorithm.java index 743873d7d..5cae22b20 100644 --- a/gax/src/main/java/com/google/api/gax/retrying/TimedRetryAlgorithm.java +++ b/gax/src/main/java/com/google/api/gax/retrying/TimedRetryAlgorithm.java @@ -34,7 +34,8 @@ /** * 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 { @@ -42,8 +43,8 @@ public interface TimedRetryAlgorithm { * Same as {@link TimedRetryAlgorithmWithContext#createFirstAttempt(RetryingContext)}, but without * a {@link RetryingContext}. * - * @deprecated use {@link TimedRetryAlgorithmWithContext#createFirstAttempt(RetryingContext)} - * instead + *

Use {@link TimedRetryAlgorithmWithContext#createFirstAttempt(RetryingContext)} instead of + * this method when possible. */ TimedAttemptSettings createFirstAttempt(); @@ -51,19 +52,17 @@ public interface TimedRetryAlgorithm { * Same as {@link TimedRetryAlgorithmWithContext#createNextAttempt(RetryingContext, * TimedAttemptSettings)}, but without a {@link RetryingContext}. * - * @deprecated use {@link TimedRetryAlgorithmWithContext#createNextAttempt(RetryingContext, - * TimedAttemptSettings)} instead + *

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 + *

Use {@link TimedRetryAlgorithmWithContext#shouldRetry(RetryingContext, + * TimedAttemptSettings)} instead of this method when possible. */ - @Deprecated boolean shouldRetry(TimedAttemptSettings nextAttemptSettings) throws CancellationException; }