使用HttpClient的HTTP连接池 [英] HTTP connection pooling using HttpClient
本文介绍了使用HttpClient的HTTP连接池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- 如何使用HttpClient创建连接池?
- 我必须经常连接同一台服务器.值得建立这样一个游泳池吗?
- 是否可以保持实时连接并将其用于各种请求,如果可以,我该怎么做?
我正在使用 Apache HTTP客户端进行Java开发.
I am developing in Java, using Apache HTTP Client.
推荐答案
[假定Java和Apache的HttpClient]
[assuming Java, and Apache's HttpClient]
Use a ThreadSafeClientConnManager. Pass a single global instance to the constructor of every HttpClient instance. I don't think there's any point in pooling the HttpClients themselves.
这篇关于使用HttpClient的HTTP连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文