Invalid use of BasicClientConnManager: connection still allocated

后端 未结 3 1692
忘掉有多难
忘掉有多难 2020-12-24 05:41

I am making a call to REST URL and trying to measure how much time it is taking to get the response back.

I am using DefaultHttpClient for that to get t

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-24 06:00

    Assuming you are using the vanilla DefaultHttpClient (which uses BasicClientConnectionManager internally), you first need to consume the outstanding/last response.

    EntityUtils.consumeQuietly(httpResponse.getEntity());

    Else, you can reallocate DefaultHttpClient each time.

    Source: Workaround to not shutdown DefaultHttpClient() each time after usage

提交回复
热议问题