简体   繁体   English

使用Apache HTTPClient时无法释放连接

[英]not able to release connection while using Apache HTTPClient

I am using HTTPCLient API's in my android app. 我在我的Android应用程序中使用HTTPCLient API。 After having made a getRequest , I wanted to release the connection . 进行getRequest之后,我想释放连接。 As per the javadoc the available method is request.releaseConnection(). 根据javadoc,可用的方法是request.releaseConnection()。 When i used that method in normal java project, it worked. 当我在普通的Java项目中使用该方法时,它起作用了。 But when I use it in my android project, Eclipse annoys me with red squiggly line and doesn't list that method in suggestion list too. 但是当我在我的android项目中使用它时,Eclipse用红色的波浪线使我烦恼,并且也没有在建议列表中列出该方法。

I referred to this question 我提到这个问题

Problems with HttpMethod.releaseConnection() and EntityUtils.consume(entity) HttpMethod.releaseConnection()和EntityUtils.consume(entity)的问题

Where one of the answer said that android comes with prepackages of httpclient libs. 答案之一是android带有httpclient libs的预包装。 So just to check I removed my external HTTPClient libraries and eclipse annoys again. 因此,仅检查一下就删除了我的外部HTTPClient库,并再次使Eclipse烦恼。

It shows error because android doesn't support this method. 它显示错误,因为android不支持此方法。 The best way to know would be press . 最好的了解方法是新闻. and Ctrl+space then it will show all the methods available from that you can see that releaseConnection() is missing. Ctrl+space ,它将显示所有可用的方法,您可以看到releaseConnection()丢失了。 So these methods will give a compilation error. 因此,这些方法将产生编译错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM