相关疑难解决方法(0)

Apache HTTP 客户端只有两个连接是可能的

我有以下代码来使用 Apache HTTP 客户端调用 REST API 方法。但是,使用上述客户端只能发送两个并行请求。是否有任何参数可以设置最大连接数?

     HttpPost post = new HttpPost(resourcePath);
            addPayloadJsonString(payload, post);//set a String Entity
            setAuthHeader(post);// set Authorization: Basic header
            try {
                return httpClient.execute(post);

            } catch (IOException e) {
                String errorMsg = "Error while executing POST statement";
                log.error(errorMsg, e);


  throw new RestClientException(errorMsg, e);
        }
Run Code Online (Sandbox Code Playgroud)

我正在使用的罐子如下,

org.apache.httpcomponents.httpclient_4.3.5.jar
org.apache.httpcomponents.httpcore_4.3.2.jar
Run Code Online (Sandbox Code Playgroud)

apache rest http httpclient

5
推荐指数
1
解决办法
9026
查看次数

标签 统计

apache ×1

http ×1

httpclient ×1

rest ×1