ITPub博客

首页 > 应用开发 > > http post请求管道断开

http post请求管道断开

作者:54xx 时间:2019-08-21 11:06:45 0 删除 编辑
通过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]


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1976/viewspace-3143981/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-16

  • 博文量
    226
  • 访问量
    1611