首页 新闻 赞助 找找看

http post请求管道断开

0
悬赏园豆:5 [已解决问题] 解决于 2019-01-18 17:13

通过httpclient访问第三方接口,并发量上来总是出现管道断开异常,这个该如何处理比较好?
请求部分代码:
CloseableHttpClient client = HttpClients.createDefault();
String content = null;
CloseableHttpResponse resp = null;
try {
resp = client.execute(httpPost);
if (resp.getStatusLine().getStatusCode() == 200) {
HttpEntity he = resp.getEntity();
content = EntityUtils.toString(he, encode);
}

异常:
o.s.boot.context.web.ErrorPageFilter :Cannot forward to error page for request [/api/xx/xxx] as the response has already been committed.
Caused by: java.io.IOException: 断开的管道
at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:1.8.0_91]
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) ~[na:1.8.0_91]
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) ~[na:1.8.0_91]
at sun.nio.ch.IOUtil.write(IOUtil.java:65) ~[na:1.8.0_91]
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) ~[na:1.8.0_91]
at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:124) ~[tomcat-coyote.jar:8.0.28]

萧萧弈寒的主页 萧萧弈寒 | 初学一级 | 园豆:170
提问于:2019-01-16 15:49
< >
分享
最佳答案
0

这个是服务端对并发访问的支持能力受限,客户端无法修正

收获园豆:5
2012 | 高人七级 |园豆:21228 | 2019-01-17 08:25
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册