且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HttpClient 4.0.1 - 如何释放连接?

更新时间:2023-02-17 15:52:34

回答我自己的问题:释放连接请求)您必须关闭由HttpEntity返回的InputStream:

To answer my own question: to release the connection (and any other resources associated with the request) you must close the InputStream returned by the HttpEntity:

InputStream is = entity.getContent();

.... process the input stream ....

is.close();       // releases all resources

docs