rlalfo / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

Network failure handling enhancement #269

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-http-java-client (e.g. 1.15.0-rc)?
1.18.0-rc

Java environment (e.g. Java 6, Android 2.3, App Engine)?
Android

Describe the problem.

Currently retryOnExecuteIOException = false by default, but it is better to 
automatically retry on transient network failure. It is very important for 
Android platform, where network is extremely unstable. 

How would you expect it to be fixed?

Set retryOnExecuteIOException = true by default.

Original issue reported on code.google.com by xinxinji...@gmail.com on 30 Nov 2014 at 8:17

GoogleCodeExporter commented 9 years ago
The retryOnExecuteIOException field is deprecated. Instead, you could provide 
an instance of HttpIOExceptionHandler [1] when instantiate your client, where 
you put your retry logic in. For your convenience, you can use the predefined 
HttpBackOffIOExceptionHandler [2] that does retry with an exponential backoff 
policy.

There are other examples regarding handling unsuccessful http requests here: 
https://code.google.com/p/google-http-java-client/wiki/ExponentialBackoff

[1] 
https://code.google.com/p/google-http-java-client/source/browse/google-http-clie
nt/src/main/java/com/google/api/client/http/HttpIOExceptionHandler.java
[2] 
https://code.google.com/p/google-http-java-client/source/browse/google-http-clie
nt/src/main/java/com/google/api/client/http/HttpBackOffIOExceptionHandler.java

Original comment by wonder...@google.com on 30 Dec 2014 at 11:12