From 2fa48f049a800d4543477d20f7248e0ac4da9c0e Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Thu, 27 Dec 2018 15:11:31 -0500 Subject: [PATCH] Add methods to decompose a RetryAlgorithm. This is extracted from https://github.com/googleapis/gax-java/pull/613/files#r229890531. It is necessary for future integration with OpenCensus to add annotation for completed attempts --- .../com/google/api/gax/retrying/RetryAlgorithm.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 057148752..d06c46039 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 @@ -31,6 +31,7 @@ import static com.google.common.base.Preconditions.checkNotNull; +import com.google.api.core.BetaApi; import java.util.concurrent.CancellationException; /** @@ -114,4 +115,14 @@ public boolean shouldRetry( && nextAttemptSettings != null && timedAlgorithm.shouldRetry(nextAttemptSettings); } + + @BetaApi("Surface for inspecting the a RetryAlgorithm is not yet stable") + public ResultRetryAlgorithm getResultAlgorithm() { + return resultAlgorithm; + } + + @BetaApi("Surface for inspecting the a RetryAlgorithm is not yet stable") + public TimedRetryAlgorithm getTimedAlgorithm() { + return timedAlgorithm; + } }