问题描述
我想知道,是否线程安全的,因为这不是在文档被提及。意味着, AndroidHttpClient
的一个实例可以在多个线程之间共享。
I was wondering, whether is AndroidHttpClient thread safe, as this is not being mentioned in documentation. Means, a single instance of AndroidHttpClient
can be shared among multiple threads.
推荐答案
是的,它是线程安全的。
Yes, it is thread safe.
AndroidHttpClient
是一个特殊的实施 DefaultHttpClient
的是pre-配置为Android。它注册 ThreadSafeClientConnManager
,允许通过一个管理连接池,线程安全的HTTP访问。 AndroidHttpClient
也为超时和套接字缓冲区大小应用合理的默认设置。它也默认支持HTTPS。
AndroidHttpClient
is a special implementation of DefaultHttpClient
which is pre-configured for Android. It registers the ThreadSafeClientConnManager
which allows thread safe HTTP access via a managed connection pool. AndroidHttpClient
also applies reasonable default settings for timeouts and socket buffer sizes. It also supports HTTPS by default.
您可以找到源头code <一个href=\"http://grep$c$c.com/file_/repository.grep$c$c.com/java/ext/com.google.android/android/2.2_r1.1/android/net/http/AndroidHttpClient.java/?v=source\">here.
You can find the source code here.
这篇关于是AndroidHttpClient线程安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!