Returns the maximum elapsed time in milliseconds. The default value is #DEFAULT_MAX_ELAPSED_TIME_MILLIS.
If the time elapsed since an ExponentialBackOff instance is created goes past the
max_elapsed_time then the method #nextBackOffMillis() starts returning BackOff#STOP. The elapsed time can be reset by calling #reset().
Returns the maximum value of the back off period in milliseconds. Once the current interval
reaches this value it stops increasing. The default value is #DEFAULT_MAX_INTERVAL_MILLIS. Must be >= initialInterval.
Sets the maximum elapsed time in milliseconds. The default value is #DEFAULT_MAX_ELAPSED_TIME_MILLIS. Must be > 0.
If the time elapsed since an ExponentialBackOff instance is created goes past the
max_elapsed_time then the method #nextBackOffMillis() starts returning BackOff#STOP. The elapsed time can be reset by calling #reset().
Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.
Sets the maximum value of the back off period in milliseconds. Once the current interval
reaches this value it stops increasing. The default value is #DEFAULT_MAX_INTERVAL_MILLIS.
Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.
Sets the randomization factor to use for creating a range around the retry interval. The
default value is #DEFAULT_RANDOMIZATION_FACTOR. Must fall in the range 0 <=
randomizationFactor < 1.
A randomization factor of 0.5 results in a random period ranging between 50% below and 50%
above the retry interval.
Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.
[[["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."],[],[],null,["# Class ExponentialBackOff.Builder (2.0.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0 (latest)](/java/docs/reference/google-http-client/latest/com.google.api.client.util.ExponentialBackOff.Builder)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.util.ExponentialBackOff.Builder)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.util.ExponentialBackOff.Builder)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.util.ExponentialBackOff.Builder)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.util.ExponentialBackOff.Builder)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.util.ExponentialBackOff.Builder)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.util.ExponentialBackOff.Builder)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.util.ExponentialBackOff.Builder) \n\n public static class ExponentialBackOff.Builder\n\nBuilder for [ExponentialBackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.ExponentialBackOff).\n\nImplementation is not thread-safe. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e ExponentialBackOff.Builder \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### Builder()\n\n public Builder()\n\nMethods\n-------\n\n### build()\n\n public ExponentialBackOff build()\n\nBuilds a new instance of [ExponentialBackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.ExponentialBackOff).\n\n### getInitialIntervalMillis()\n\n public final int getInitialIntervalMillis()\n\nReturns the initial retry interval in milliseconds. The default value is #DEFAULT_INITIAL_INTERVAL_MILLIS.\n\n### getMaxElapsedTimeMillis()\n\n public final int getMaxElapsedTimeMillis()\n\nReturns the maximum elapsed time in milliseconds. The default value is #DEFAULT_MAX_ELAPSED_TIME_MILLIS.\n\nIf the time elapsed since an [ExponentialBackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.ExponentialBackOff) instance is created goes past the\nmax_elapsed_time then the method #nextBackOffMillis() starts returning [BackOff#STOP](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff#com_google_api_client_util_BackOff_STOP). The elapsed time can be reset by calling #reset().\n\n### getMaxIntervalMillis()\n\n public final int getMaxIntervalMillis()\n\nReturns the maximum value of the back off period in milliseconds. Once the current interval\nreaches this value it stops increasing. The default value is #DEFAULT_MAX_INTERVAL_MILLIS. Must be `\u003e= initialInterval`.\n\n### getMultiplier()\n\n public final double getMultiplier()\n\nReturns the value to multiply the current interval with for each retry attempt. The default\nvalue is #DEFAULT_MULTIPLIER.\n\n### getNanoClock()\n\n public final NanoClock getNanoClock()\n\nReturns the nano clock.\n\n### getRandomizationFactor()\n\n public final double getRandomizationFactor()\n\nReturns the randomization factor to use for creating a range around the retry interval. The\ndefault value is #DEFAULT_RANDOMIZATION_FACTOR.\n\nA randomization factor of 0.5 results in a random period ranging between 50% below and 50%\nabove the retry interval.\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else.\n\n### setInitialIntervalMillis(int initialIntervalMillis)\n\n public ExponentialBackOff.Builder setInitialIntervalMillis(int initialIntervalMillis)\n\nSets the initial retry interval in milliseconds. The default value is #DEFAULT_INITIAL_INTERVAL_MILLIS. Must be `\u003e 0`.\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else.\n\n### setMaxElapsedTimeMillis(int maxElapsedTimeMillis)\n\n public ExponentialBackOff.Builder setMaxElapsedTimeMillis(int maxElapsedTimeMillis)\n\nSets the maximum elapsed time in milliseconds. The default value is #DEFAULT_MAX_ELAPSED_TIME_MILLIS. Must be `\u003e 0`.\n\nIf the time elapsed since an [ExponentialBackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.ExponentialBackOff) instance is created goes past the\nmax_elapsed_time then the method #nextBackOffMillis() starts returning [BackOff#STOP](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff#com_google_api_client_util_BackOff_STOP). The elapsed time can be reset by calling #reset().\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else.\n\n### setMaxIntervalMillis(int maxIntervalMillis)\n\n public ExponentialBackOff.Builder setMaxIntervalMillis(int maxIntervalMillis)\n\nSets the maximum value of the back off period in milliseconds. Once the current interval\nreaches this value it stops increasing. The default value is #DEFAULT_MAX_INTERVAL_MILLIS.\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else.\n\n### setMultiplier(double multiplier)\n\n public ExponentialBackOff.Builder setMultiplier(double multiplier)\n\nSets the value to multiply the current interval with for each retry attempt. The default\nvalue is #DEFAULT_MULTIPLIER. Must be `\u003e= 1`.\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else.\n\n### setNanoClock(NanoClock nanoClock)\n\n public ExponentialBackOff.Builder setNanoClock(NanoClock nanoClock)\n\nSets the nano clock ([NanoClock#SYSTEM](/java/docs/reference/google-http-client/latest/com.google.api.client.util.NanoClock#com_google_api_client_util_NanoClock_SYSTEM) by default).\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else.\n\n### setRandomizationFactor(double randomizationFactor)\n\n public ExponentialBackOff.Builder setRandomizationFactor(double randomizationFactor)\n\nSets the randomization factor to use for creating a range around the retry interval. The\ndefault value is #DEFAULT_RANDOMIZATION_FACTOR. Must fall in the range `0 \u003c=\nrandomizationFactor \u003c 1`.\n\nA randomization factor of 0.5 results in a random period ranging between 50% below and 50%\nabove the retry interval.\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else."]]