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的更多相关文章

  1. Servlet 3特性:异步Servlet

    解异步Servlet之前,让我们试着理解为什么需要它.假设我们有一个Servlet需要很多的时间来处理,类似下面的内容: LongRunningServlet.java package com.jou ...

  2. 关于webservlet 请求异步处理,链接未关闭出现的bug

    webservlet  +redis 的消息发布订阅 ,挺好的 当请求到来,向redis server申请一个频道 ,然后等着另一端架设是B 处理完毕获得到处理信息调用redis ,使用redis 往 ...

  3. springmvc webservlet 异步请求总结

    1:每次请求会启动一个新线程 上边在debug状态下, 每次请求一次,生成一个新的 thread  在此已经是245了 出现一个现象在debug模式下, 每次请求生成的线程,自动在红框那个位置停了下来 ...

  4. 千万不要把Request传递到异步线程里面!有坑!

    你好哇,我是歪歪. 前几天在网上冲浪的时候看到一篇技术文章,讲的是他把一个 request 请求传递到了线程池里面,然后遇到了一个匪夷所思的情况. 他写了这篇文章,把自己针对这个问题的探索过程分享了出 ...

  5. springmvc中request的线程安全问题

    SpringMvc学习心得(四)springmvc中request的线程安全问题 标签: springspring mvc框架线程安全 2016-03-19 11:25 611人阅读 评论(1) 收藏 ...

  6. arcgis server "System.Web.Services.Protocols.SoapException: Error processing server request".

    在 Arcgis Server 10中创建第一个程序,运行的时候就报错:System.Web.Services.Protocols.SoapException: Error processing se ...

  7. Servlet3.0新特性

    1 Servlet3.0新特性概述 使用要求:MyEclipse10.0或以上版本,发布到Tomcat7.0或以上版本,创建JavaEE6.0应用! Servlete3.0的主要新特性如下三部分: 使 ...

  8. 你的响应阻塞了没有?--Spring-WebFlux源码分析

    1. Spring WebFlux是什么? Spring WebFlux是Spring Framework 5.0中引入的新的反应式Web框架. 与Spring MVC不同,它不需要Servlet A ...

  9. 十八、泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器基础加强

    l 泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器 泛型 1 回顾泛型类 泛型类:具有一个或多个泛型变量的类被称之为泛型类. public class A<T> { ...

随机推荐

  1. iOS 多线程简单使用的具体解释

    主线程 一个iOS程序执行后.默认会开启1条线程,称为"主线程"或"UI线程"(刷新UI界面最好在主线程中做.在子线程中可能会出现莫名其妙的BUG) 主线程的作 ...

  2. 最简单安装laravel

    http://laravelacademy.org/resources-download

  3. 给你的 Golang 程序添加 GUI (使用 Electron )

    https://studygolang.com/articles/12065?fr=sidebar https://www.jianshu.com/p/a3be0d206d4c  另一种思路 推荐方式 ...

  4. 第五种方式,python使用组合来添加类方法和属性(二),以selenium的webdriver为例

    组合优点多,但经常比继承需要额外的代码. 上一篇是 介绍装饰器.继承.元类.mixin,四种給类动态添加类属性和方法的四种方式. 此篇介绍直接把被组合的类的属性直接加入到类里面,前面的四个例子很简单, ...

  5. Java从控制台接受输入字符

    创建一个类,在该类的主方法中创建Scanner扫描起来封装System类的in输入流,然后提示用户输入身份证号码,并输入身份证号码的位数. 代码如下: import java.util.Scanner ...

  6. Linux下tomcat无法启动

    场景:干净的tomcat,刚解压 1 通过./startup.sh,提示启动成功,但查看没有日志 2 通过netstat -tln查看端口,发现找不到8080 3 通过./catalina.sh ru ...

  7. swift--歌曲播放示例

    使用MPMoviePlayerController我们可以是进行音乐播放,如下图: 接口的话,我是自己在本地上搭建了个服务器,自己请求自己

  8. List中的Contains方法内部其实是用对象的equals方法做比较,所以如果比较两个类就重写类的equals方法即可;而Set是调用equals和hashCode

    public class Person { private String name; private int age; public String getName() { return name; } ...

  9. Splash autoload() 方法

    autoload() 方法可以设置每个页面访问时自动加载的对象,比如自动加载 JavaScript 代码,自动加载 Ajax 代码等等 注意此方法只负责加载 JavaScript/Ajax 代码,不执 ...

  10. CentOS7安装ipython

    python版本:2.7.5 yum install -y python2-pip.noarchyum install -y python-develpip install ipython==5.4. ...