Best Practice to Use HttpClient in Multithreaded Environment

后端 未结 5 1856
猫巷女王i
猫巷女王i 2020-11-27 09:40

For a while, I have been using HttpClient in a multithreaded environment. For every thread, when it initiates a connection, it will create a completely new HttpClient instan

5条回答
  •  死守一世寂寞
    2020-11-27 10:40

    I think you will want to use ThreadSafeClientConnManager.

    You can see how it works here: http://foo.jasonhudgins.com/2009/08/http-connection-reuse-in-android.html

    Or in the AndroidHttpClient which uses it internally.

提交回复
热议问题