博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
The request associated with the AsyncContext has already completed processing
阅读量:4465 次
发布时间:2019-06-08

本文共 1651 字,大约阅读时间需要 5 分钟。

Some time ago there was a problem with the servlet3.0, is in servlet in asynchronous processing data, due to time outs, dry method terminates, but the back throws, anomalies are as follows:

java.lang.IllegalStateException: The request associated with the AsyncContext has already completed processing.       at org.apache.catalina.core.AsyncContextImpl.check(AsyncContextImpl.java:521)       at org.apache.catalina.core.AsyncContextImpl.getResponse(AsyncContextImpl.java:245)

Appeared and the reason for this is because asynchronous processing time servlet the default is 10 seconds, apparently because the data is too large, resulting in time out.

The solution is simple only in the doPost method of servlet add a sentence

asyncContext.setTimeout(900000000);

For asynchronous loading manual setting the timeout can be, all the code as follows:

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {        request.setCharacterEncoding("UTF-8");        response.setContentType(getServletContext().getInitParameter("content"));			//In asynchronous mode, call the business processing threads to process business        //Servlet will not be blocked, but directly to the execution        //Business processing after the completion of the response by the AsyncContext management        AsyncContext asyncContext = request.startAsync();        asyncContext.setTimeout(900000000);        ProductHandleThread productHandleThread = new ProductHandleThread(asyncContext,request.getSession());        asyncContext.start(productHandleThread);	}

  

转载于:https://www.cnblogs.com/jiaoyiping/p/5988858.html

你可能感兴趣的文章
python之路-基础篇-第七周
查看>>
高性能队列Disruptor系列2--浅析Disruptor
查看>>
ViurtualBox配置虚拟机Linux的网络环境
查看>>
VLC 媒体播放器
查看>>
勿忘国耻2018/09/18
查看>>
Jenkins部署码云SpringBoot项目
查看>>
多标签分类(multi-label classification)综述
查看>>
史上最全面的Spring-Boot-Cache使用与整合
查看>>
图的遍历(深度优先与广度优先搜索两种方案)
查看>>
快速读入模板
查看>>
把一张图片变成base64
查看>>
impdp报错: ORA-39064: 无法写入日志文件 ORA-29285: 文件写入错误
查看>>
\n ^ \t的使用
查看>>
css盒模型
查看>>
计算机学科各专业大牛
查看>>
MongoDB配置--同一台服务器搭建多MongoDB实例
查看>>
Myeclipse上配置weblogic11g(10.3.6)的方法教程
查看>>
本地推送通知UILocalNotification
查看>>
计算机网络: IP地址,子网掩码,网段表示法,默认网关,DNS服务器详解
查看>>
微信自动加人软件安装使用
查看>>