vladukua / google-api-java-client

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

HttpTransport should be thread-safe #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?

N/A

Java environments (e.g. Java 6, Android 2.3, App Engine 1.4.2, or All)?

All.

Please describe the feature requested.

HttpTransport is not thread safe. For a multi-threaded application you 
therefore have these choices:
1. Only use it from a single thread.
2. Only modify it before any threads are started.
3. Use thread-local (but then you have duplicate copy for each thread, and any 
time you update it in one thread, you have to update it in all threads).
4. Use some kind of custom synchronization lock every time you access 
HttpTransport.

This makes the library difficult to use for multi-threaded applications.  With 
OAuth 2 for example, we want to be able to refresh the access token when it 
expires, which requires updating the HttpTransport instance.  The only really 
viable way to write a utility library that does this for you automatically is 
to make HttpTransport thread-safe.

Original issue reported on code.google.com by yan...@google.com on 11 Mar 2011 at 12:24

GoogleCodeExporter commented 9 years ago
http://codereview.appspot.com/4428072/

Original comment by yan...@google.com on 30 Apr 2011 at 2:10

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 2 May 2011 at 8:16

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 5 May 2011 at 7:31