前段时间在用servlet3.0时出现了一个问题,就是在servlet在异步处理数据时,由于时间超时,索然方法执行结束,但是后台抛出了异常,异常如下:
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)
出现这个的原因是因为servlet默认的异步处理时间为10秒,显然由于数据量过大,导致时间超时。
解决办法也很简单只需要在servlet的doPost方法中加入一下一句
asyncContext.setTimeout(900000000);
为异步加载手动的设置超时时间即可,全部代码如下:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setContentType(getServletContext().getInitParameter("content")); //进入异步模式,调用业务处理线程进行业务处理 //Servlet不会被阻塞,而是直接往下执行 //业务处理完成后的回应由AsyncContext管理 AsyncContext asyncContext = request.startAsync(); asyncContext.setTimeout(900000000); ProductHandleThread productHandleThread = new ProductHandleThread(asyncContext,request.getSession()); asyncContext.start(productHandleThread); }
相关推荐
1.将sqlite3.exe放到.svn的同级目录 2.启动cmd执行sqlite3 .svn/wc.db 3. "select * from work_queue"; 4. delete from work_queue; 5.svn目录下右键:TortoiseSVN->Clean up
16. The delay components are processing delays, transmission delays, propagation delays, and queuing delays. All of these delays are fixed, except for the queuing delays, which are variable. 17. a) ...
Storm Applied is a practical guide to using Apache Storm for the real-world tasks associated with processing and analyzing real-time data streams. This immediately useful book starts by building a ...
Returns a boolean indicating whether the named response header has already been set. contextDestroyed(ServletContextEvent) - Method in interface javax.servlet.ServletContextListener Notification ...
文献,希望能帮助需要次文献的人dietary folate alters the mouse sperm epigenome and is associated with.pdf
No Elf file associated with target 这是vivado2016.4的bug 解决方案: 1.使用system debug 代替 GDB 2.替换xmdterm.tcl 文件: 下载本xmdterm.tcl 资源,然后到你的SDK的安装目录下替换原来的xmdterm.tcl ...
Firstly, unlike the classical Wigner-Ville transform, a new definition of Wigner-Ville distribution associated with the linear canonical transform is given. Then, the main properties of the
标题"AAMI TIR42:2021 Evaluation of particulate associated with vascul"涉及到的是一个关于医疗设备中微粒评估的行业标准。这个标题暗示了文档内容将深入探讨血管医学设备在使用过程中可能产生的微粒物质,以及...
Each particle keeps track of its coordinates in the problem space which are associated with the best solution (fitness) it has achieved so far. (The fitness value is also stored.) This value is ...
jGuru has been dedicated to promoting the growth of the Java technology community through evangelism, education, and software since 1995. You can find out more about their activities, including ...
This book provides an overview of modern boot firmware, including the Unified Extensible Firmware Interface (Uefi) and its associated Efi Developer Kit Ii (Edkii) firmware. The authors have each made ...
and process text using the R language and will equip you with the tools and the associated knowledge about different tagging, chunking, and entailment approaches and their usage in natural language ...
标题中的“it contains all the MATLAB demo code associated with my”表明这是一个包含与个人机器学习笔记相关的MATLAB演示代码的集合。MATLAB是一种强大的编程环境,特别适用于数值计算、符号计算、数据可视化...
A cross-cutting theme of the book is the challenges associated with scaling up multicore systems to hundreds of cores. The book provides an overview of significant developments in the architectures ...
and process text using the R language and will equip you with the tools and the associated knowledge about different tagging, chunking, and entailment approaches and their usage in natural language ...
However, the req_mode column of master.dbo.syslockinfo has lock mode code that is one less than the code values shown here. For example, value of req_mode = 3 represents the Shared lock mode rather ...
标题中的“it contains all the MATLAB demo code associated with my machine learning notes”表明这是一份与机器学习相关的MATLAB演示代码集合。这些代码可能是为了辅助理解、实践或者解释在机器学习笔记中提到的...