使用单例模式 1.2.1. HttpClient thread safety HttpClient implementations are expected to be thread safe. It is recommended that the same instance of this class is reused for multiple request executions. 由官方文档可知,HttpClient 是线程安全的,建议使用同一实例。 因此使用单例模式创建,优化反复创建的开销。 设置 Pooling connection manager PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); // Increase max total connection to 200 cm.setMaxTotal(200); // Increase default max connection per route to 20 cm.setDefaultMaxPerR.... HttpClient 4.5 的一些优化 Java