AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
``` public class HttpClientPool { public static void main(String[] args) { PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal(100);//最大连接数 cm.setDefaultMaxPerRoute(10);//设置每个主机的最大连接数 doGet(cm); doGet(cm); } private static void doGet(PoolingHttpClientConnectionManager cm){ CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build(); HttpGet httpGet = new HttpGet("http://www.baidu.com"); CloseableHttpResponse response = null; try { response = httpClient.execute(httpGet); if (response.getStatusLine().getStatusCode() == 200){ String content = EntityUtils.toString(response.getEntity(), "utf8"); System.out.println(content); } } catch (IOException e) { e.printStackTrace(); }finally { try { response.close(); }catch (Exception e){ e.printStackTrace(); } } } } ```