Returns the current (active on the moment of the execution of this method) attempt result
future, allowing to track progress of the retrying future execution.
Adding direct executor (same thread) callbacks to the future returned by this method is
strongly not recommended, since the future is resolved under retrying future's internal lock
and may affect the whole retrying process. Adding separate thread callbacks is ok.
This method is for internal/advanced use only.
The returned future completes right after the corresponding attempt which it tracks, so
calling ApiFuture#get() is potentially a blocking operation. This method returns
exactly same future object until it completes (meaning that the corresponding attempt has
completed). If there is another attempt made after completion of the current attempt, the
subsequent call to this method will return a new future which will track the new attempt.
In case if the whole retrying future is completed, this method returns the same result as
the retrying future itself.
The returned future is non-cancellable, so calling ApiFuture#cancel(boolean) will
have no effect and will always return false.
The number of attempt results may be (and usually is) lower than the number of actual
attempts, since only a completed attempt has a result and not all attempts complete (some of
the service attempts, needed for proper execution of the actual attempts).
For each execution the following invariants hold:
The future returned by this method completes soon after the attempt it tracks.
If it was the last attempt, the futures complete in the following order: 1) the attempt
future; 2) the whole retrying future; 3) the attempt result future returned by this
method.
After completion of the whole retrying future this method always returns exactly same
future object.
Returns latest completed attempt result or null if the first attempt hasn't completed
yet.
This method is for internal/advanced use only.
If not null, the returned value is guaranteed to be an already completed future, so ApiFuture#isDone() will always be true and ApiFuture#get() will always be
non-blocking.
In case if the whole retrying future is completed, this method returns the same result as
the retrying future itself.
The number of attempt results may be (and usually is) lower than the number of actual
attempts, since only a completed attempt has a result and not all attempts complete (some of
the service attempts, needed for proper execution of the actual attempts).
For each execution the following invariants hold:
If the first attempt hasn't completed yet, this method returns null.
Right after completion of each attempt this method starts returning a new already
completed future, which represents the result of the latest completed attempt.
If it was the last attempt, the events happen in the following order: 1) the attempt
future completes; 2) the whole retrying future completes; 3) this method starts returning
a new already completed future, which represents the result of the last completed
attempt.
After completion of the whole retrying future this method always returns exactly same
future object.
Sets the attempt in a form of a future. This future represents a concrete retry attempt,
potentially scheduled for execution in a some form of java.util.concurrent.ScheduledExecutorService, or an already completed future if the attempts
are executed synchronously.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThis webpage provides documentation for the \u003ccode\u003eRetryingFuture\u003c/code\u003e interface in the Google API Client Library for Java, with the latest version being 2.63.1.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRetryingFuture\u003c/code\u003e interface manages the asynchronous or synchronous execution of a retriable task, abstracting the complexities involved.\u003c/p\u003e\n"],["\u003cp\u003eIt is intended for advanced or internal use, and extends the \u003ccode\u003eApiFuture\u003c/code\u003e interface.\u003c/p\u003e\n"],["\u003cp\u003eThe documentation details various methods of the \u003ccode\u003eRetryingFuture\u003c/code\u003e interface, including \u003ccode\u003egetAttemptResult()\u003c/code\u003e, \u003ccode\u003egetAttemptSettings()\u003c/code\u003e, \u003ccode\u003egetCallable()\u003c/code\u003e, \u003ccode\u003epeekAttemptResult()\u003c/code\u003e, and \u003ccode\u003esetAttemptFuture()\u003c/code\u003e, each serving specific purposes in tracking and managing retry attempts.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetAttemptResult()\u003c/code\u003e and \u003ccode\u003epeekAttemptResult()\u003c/code\u003e methods provide insights into attempt results, with the latter providing the last completed attempt result, and the first giving the active attempt result, if any.\u003c/p\u003e\n"]]],[],null,["# Interface RetryingFuture<ResponseT> (2.69.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.69.0 (latest)](/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetryingFuture)\n- [2.68.2](/java/docs/reference/gax/2.68.2/com.google.api.gax.retrying.RetryingFuture)\n- [2.67.0](/java/docs/reference/gax/2.67.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.66.0](/java/docs/reference/gax/2.66.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.65.0](/java/docs/reference/gax/2.65.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.63.1](/java/docs/reference/gax/2.63.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.62.0](/java/docs/reference/gax/2.62.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.61.0](/java/docs/reference/gax/2.61.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.60.0](/java/docs/reference/gax/2.60.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.59.1](/java/docs/reference/gax/2.59.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.58.0](/java/docs/reference/gax/2.58.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.57.0](/java/docs/reference/gax/2.57.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.55.0](/java/docs/reference/gax/2.55.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.54.1](/java/docs/reference/gax/2.54.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.53.0](/java/docs/reference/gax/2.53.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.52.0](/java/docs/reference/gax/2.52.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.51.0](/java/docs/reference/gax/2.51.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.50.0](/java/docs/reference/gax/2.50.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.49.0](/java/docs/reference/gax/2.49.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.48.1](/java/docs/reference/gax/2.48.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.47.0](/java/docs/reference/gax/2.47.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.46.1](/java/docs/reference/gax/2.46.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.45.0](/java/docs/reference/gax/2.45.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.43.0](/java/docs/reference/gax/2.43.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.42.0](/java/docs/reference/gax/2.42.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.41.0](/java/docs/reference/gax/2.41.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.39.0](/java/docs/reference/gax/2.39.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.38.0](/java/docs/reference/gax/2.38.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.37.0](/java/docs/reference/gax/2.37.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.36.0](/java/docs/reference/gax/2.36.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.35.0](/java/docs/reference/gax/2.35.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.34.1](/java/docs/reference/gax/2.34.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.33.0](/java/docs/reference/gax/2.33.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.32.1](/java/docs/reference/gax/2.32.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.31.1](/java/docs/reference/gax/2.31.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.30.1](/java/docs/reference/gax/2.30.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.24.0](/java/docs/reference/gax/2.24.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.23.3](/java/docs/reference/gax/2.23.3/com.google.api.gax.retrying.RetryingFuture)\n- [2.22.0](/java/docs/reference/gax/2.22.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.21.0](/java/docs/reference/gax/2.21.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.20.1](/java/docs/reference/gax/2.20.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.19.6](/java/docs/reference/gax/2.19.6/com.google.api.gax.retrying.RetryingFuture)\n- [2.18.7](/java/docs/reference/gax/2.18.7/com.google.api.gax.retrying.RetryingFuture)\n- [2.17.0](/java/docs/reference/gax/2.17.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.16.0](/java/docs/reference/gax/2.16.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.15.0](/java/docs/reference/gax/2.15.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.14.0](/java/docs/reference/gax/2.14.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.13.0](/java/docs/reference/gax/2.13.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.12.2](/java/docs/reference/gax/2.12.2/com.google.api.gax.retrying.RetryingFuture)\n- [2.11.0](/java/docs/reference/gax/2.11.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.10.0](/java/docs/reference/gax/2.10.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.9.0](/java/docs/reference/gax/2.9.0/com.google.api.gax.retrying.RetryingFuture)\n- [2.8.1](/java/docs/reference/gax/2.8.1/com.google.api.gax.retrying.RetryingFuture)\n- [2.7.1](/java/docs/reference/gax/2.7.1/com.google.api.gax.retrying.RetryingFuture) \n\n public interface RetryingFuture\u003cResponseT\u003e extends ApiFuture\u003cResponseT\u003e\n\nRepresents a retrying future. This is a facade hiding all the complications of an\nasynchronous/synchronous execution of a retriable task.\n\nThis interface is for advanced/internal use only. \n\nImplements\n----------\n\n[ApiFuture](https://cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html)\\\u003cResponseT\\\u003e\n\nMethods\n-------\n\n### getAttemptResult()\n\n public abstract ApiFuture\u003cResponseT\u003e getAttemptResult()\n\nReturns the current (active on the moment of the execution of this method) attempt result\nfuture, allowing to track progress of the retrying future execution.\n\nAdding direct executor (same thread) callbacks to the future returned by this method is\nstrongly not recommended, since the future is resolved under retrying future's internal lock\nand may affect the whole retrying process. Adding separate thread callbacks is ok.\n\nThis method is for internal/advanced use only.\n\nThe returned future completes right after the corresponding attempt which it tracks, so\ncalling ApiFuture#get() is potentially a blocking operation. This method returns\nexactly same future object until it completes (meaning that the corresponding attempt has\ncompleted). If there is another attempt made after completion of the current attempt, the\nsubsequent call to this method will return a new future which will track the new attempt.\n\nIn case if the whole retrying future is completed, this method returns the same result as\nthe retrying future itself.\n\nThe returned future is non-cancellable, so calling ApiFuture#cancel(boolean) will\nhave no effect and will always return `false`.\n\nThe number of attempt results may be (and usually is) lower than the number of actual\nattempts, since only a completed attempt has a result and not all attempts complete (some of\nthe service attempts, needed for proper execution of the actual attempts).\n\nFor each execution the following invariants hold:\n\n- The future returned by this method completes soon after the attempt it tracks.\n- If it was the last attempt, the futures complete in the following order: 1) the attempt future; 2) the whole retrying future; 3) the attempt result future returned by this method.\n- After completion of the whole retrying future this method always returns exactly same future object.\n\n### getAttemptSettings()\n\n public abstract TimedAttemptSettings getAttemptSettings()\n\nReturns current (active) attempt settings.\n\n### getCallable()\n\n public abstract Callable\u003cResponseT\u003e getCallable()\n\nReturns callable tracked by this future.\n\n### peekAttemptResult()\n\n public abstract ApiFuture\u003cResponseT\u003e peekAttemptResult()\n\nReturns latest completed attempt result or `null` if the first attempt hasn't completed\nyet.\n\nThis method is for internal/advanced use only.\n\nIf not null, the returned value is guaranteed to be an already completed future, so ApiFuture#isDone() will always be `true` and ApiFuture#get() will always be\nnon-blocking.\n\nIn case if the whole retrying future is completed, this method returns the same result as\nthe retrying future itself.\n\nThe number of attempt results may be (and usually is) lower than the number of actual\nattempts, since only a completed attempt has a result and not all attempts complete (some of\nthe service attempts, needed for proper execution of the actual attempts).\n\nFor each execution the following invariants hold:\n\n- If the first attempt hasn't completed yet, this method returns `null`.\n- Right after completion of each attempt this method starts returning a new already completed future, which represents the result of the latest completed attempt.\n- If it was the last attempt, the events happen in the following order: 1) the attempt future completes; 2) the whole retrying future completes; 3) this method starts returning a new already completed future, which represents the result of the last completed attempt.\n- After completion of the whole retrying future this method always returns exactly same future object.\n\n### setAttemptFuture(ApiFuture\\\u003cResponseT\\\u003e attemptFuture)\n\n public abstract void setAttemptFuture(ApiFuture\u003cResponseT\u003e attemptFuture)\n\nSets the attempt in a form of a future. This future represents a concrete retry attempt,\npotentially scheduled for execution in a some form of [java.util.concurrent.ScheduledExecutorService](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html), or an already completed future if the attempts\nare executed synchronously."]]