[[["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 HttpBackOffUnsuccessfulResponseHandler (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.http.HttpBackOffUnsuccessfulResponseHandler)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler) \n\n public class HttpBackOffUnsuccessfulResponseHandler implements HttpUnsuccessfulResponseHandler\n\n[Beta](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta) \n\nBack-off handler which handles an abnormal HTTP response with [BackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff).\n\nIt is designed to work with only one [HttpRequest](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpRequest) at a time. As a result you MUST\ncreate a new instance of [HttpBackOffUnsuccessfulResponseHandler](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler) with a new instance of\n[BackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff) for each instance of [HttpRequest](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpRequest).\n\nSample usage:\n\nrequest.setUnsuccessfulResponseHandler(\nnew HttpBackOffUnsuccessfulResponseHandler(new ExponentialBackOff()));\n\nNote: Implementation doesn't call [BackOff#reset](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff#com_google_api_client_util_BackOff_reset_) at all, since it expects a new [BackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff) instance.\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 HttpBackOffUnsuccessfulResponseHandler \n\nImplements\n----------\n\n[HttpUnsuccessfulResponseHandler](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpUnsuccessfulResponseHandler) \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### HttpBackOffUnsuccessfulResponseHandler(BackOff backOff)\n\n public HttpBackOffUnsuccessfulResponseHandler(BackOff backOff)\n\nConstructs a new instance from a [BackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff).\n\nMethods\n-------\n\n### getBackOff()\n\n public final BackOff getBackOff()\n\nReturns the back-off.\n\n### getBackOffRequired()\n\n public final HttpBackOffUnsuccessfulResponseHandler.BackOffRequired getBackOffRequired()\n\nReturns the BackOffRequired instance which determines if back-off is required based on\nan abnormal HTTP response.\n\n### getSleeper()\n\n public final Sleeper getSleeper()\n\nReturns the sleeper.\n\n### handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry)\n\n public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry)\n\nHandler that will be invoked when an abnormal response is received. There are a few simple\nrules that one must follow:\n\n- If you modify the request object or modify its execute interceptors in a way that should resolve the error, you must return true to issue a retry.\n- Do not read from the content stream, this will prevent the eventual end user from having access to it.\n\nHandles the request with [BackOff](/java/docs/reference/google-http-client/latest/com.google.api.client.util.BackOff). That means that if back-off is required a call to\n[Sleeper#sleep(long)](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Sleeper#com_google_api_client_util_Sleeper_sleep_long_) will be made.\n\n### setBackOffRequired(HttpBackOffUnsuccessfulResponseHandler.BackOffRequired backOffRequired)\n\n public HttpBackOffUnsuccessfulResponseHandler setBackOffRequired(HttpBackOffUnsuccessfulResponseHandler.BackOffRequired backOffRequired)\n\nSets the BackOffRequired instance which determines if back-off is required based on an\nabnormal HTTP response.\n\nThe default value is BackOffRequired#ON_SERVER_ERROR.\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else.\n\n### setSleeper(Sleeper sleeper)\n\n public HttpBackOffUnsuccessfulResponseHandler setSleeper(Sleeper sleeper)\n\nSets the sleeper.\n\nThe default value is [Sleeper#DEFAULT](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Sleeper#com_google_api_client_util_Sleeper_DEFAULT).\n\nOverriding is only supported for the purpose of calling the super implementation and\nchanging the return type, but nothing else."]]