The request associated with the AsyncContext has already completed processing
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:)
at org.apache.catalina.core.AsyncContextImpl.getResponse(AsyncContextImpl.java:)
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();
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);
}
The request associated with the AsyncContext has already completed processing的更多相关文章
- Servlet 3特性:异步Servlet
解异步Servlet之前,让我们试着理解为什么需要它.假设我们有一个Servlet需要很多的时间来处理,类似下面的内容: LongRunningServlet.java package com.jou ...
- 关于webservlet 请求异步处理,链接未关闭出现的bug
webservlet +redis 的消息发布订阅 ,挺好的 当请求到来,向redis server申请一个频道 ,然后等着另一端架设是B 处理完毕获得到处理信息调用redis ,使用redis 往 ...
- springmvc webservlet 异步请求总结
1:每次请求会启动一个新线程 上边在debug状态下, 每次请求一次,生成一个新的 thread 在此已经是245了 出现一个现象在debug模式下, 每次请求生成的线程,自动在红框那个位置停了下来 ...
- 千万不要把Request传递到异步线程里面!有坑!
你好哇,我是歪歪. 前几天在网上冲浪的时候看到一篇技术文章,讲的是他把一个 request 请求传递到了线程池里面,然后遇到了一个匪夷所思的情况. 他写了这篇文章,把自己针对这个问题的探索过程分享了出 ...
- springmvc中request的线程安全问题
SpringMvc学习心得(四)springmvc中request的线程安全问题 标签: springspring mvc框架线程安全 2016-03-19 11:25 611人阅读 评论(1) 收藏 ...
- arcgis server "System.Web.Services.Protocols.SoapException: Error processing server request".
在 Arcgis Server 10中创建第一个程序,运行的时候就报错:System.Web.Services.Protocols.SoapException: Error processing se ...
- Servlet3.0新特性
1 Servlet3.0新特性概述 使用要求:MyEclipse10.0或以上版本,发布到Tomcat7.0或以上版本,创建JavaEE6.0应用! Servlete3.0的主要新特性如下三部分: 使 ...
- 你的响应阻塞了没有?--Spring-WebFlux源码分析
1. Spring WebFlux是什么? Spring WebFlux是Spring Framework 5.0中引入的新的反应式Web框架. 与Spring MVC不同,它不需要Servlet A ...
- 十八、泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器基础加强
l 泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器 泛型 1 回顾泛型类 泛型类:具有一个或多个泛型变量的类被称之为泛型类. public class A<T> { ...
随机推荐
- font-awesome 使用方法
需要引入文件 font-awesome.css <link rel="stylesheet" href="{$yf_theme_path}public/font-a ...
- SOCKET,TCP/IP,UDP,HTTP,FTP总结
一.TCP/UDP,SOCKET,HTTP,FTP简析 TCP/IP是个协议组(主要解决数据如何在网络中传输),可分为三个层次:网络层.传输层和应用层: 网络层:IP协议.ICMP协议.ARP协议 ...
- The difference between the request time and the current time is too large.阿里云oss上传图片报错
The difference between the request time and the current time is too large. 阿里云oss上传图片的时候报错如上, 解决办法,把 ...
- vue-cli打包之后的项目在nginx的部署
vue-cli执行 npm run build 进行打包,生成dist文件夹,把该文件夹下的文件直接复制到nginx服务器目录下,就可打开项目,但是只有首页是可以看到的,再刷新一下就404了,原因是v ...
- python日志,支持彩色打印和文件大小切片写入和写入mongodb
1.项目中使用了自定义的ColorHandler和MongoHandler,使用了内置的RotatingFileHandler和三方库的ConcurrentRotatingFileHandler. 支 ...
- while 1要小心
之前判断一个接口的返回,一定约定好了是返回retcode 1或者retcode 0,就用的这个判断,但是接口挂了的时候,一直返回未登录,找了很长时间为什么cpu一直消耗那么高. 使用wihle 1时候 ...
- ssh事务回滚,纪念这几个月困扰已久的心酸
以前的事务采用的是JTA,xml注入的方式.本人就着开发要优雅合理利用轮子的态度,一直不满意JTA式的申明和切入方式. spring的注解方式多优雅,可是万恶的直到项目快要上线时终于找到了注解式不能回 ...
- PHP代码层防护与绕过
0x01 前言 在一些网站通常会在公用文件引入全局防护代码进行SQL注入.XSS跨站脚本等漏洞的防御,在一定程度上对网站安全防护还是比较有效的. 这里讨论一下关键字过滤不完善及常见正则匹配存在的问题, ...
- 开源CMS的比较和选择
最近就cms系统折腾了一下,主要还是以 构架为主,以下做一个大概的比较: 1. Nuke 一般称为DNN,这是最开始Microsoft发布 的时候,用vb做了一个web的演示例子,最终这个例子发展成了 ...
- Nginx 防盗链
“盗链”的定义是:此内容不在自己服务器上,而通过技术手段,绕过别人放广告有利益的最终页,直接在自己的有广告有利益的页面上向最终用户提供此内容. 常常是一些小网站来盗取一些有实力的大网站的地址(比如一些 ...