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. Java无参构造方法

    一定要保留无参构造方法.---------->反射是最重要的操作原理,大量地应用了反射处理机制. 如Struts.Spring框架等.

  2. hive 配置元数据以mysql 存储

    <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="confi ...

  3. JUC回顾之-ConcurrentHashMap源码解读及原理理解

    ConcurrentHashMap结构图如下: ConcurrentHashMap实现类图如下: segment的结构图如下: package concurrentMy.juc_collections ...

  4. Java实习生面试题整理

    一.数据类型 包装类型 八个基本类型: boolean/1 byte/8 char/16 short/16 int/32 float/32 long/64 double/64 基本类型都有对应的包装类 ...

  5. 让github忽略某些文件

    打开 https://github.com/github/gitignore 找到自己需要的android.gitignore 打开 Repository Settings , 把那些东东加进来,然后 ...

  6. mySql的desc与explain分析性能(主要分析索引)

    desc select * from A where id =‘110’; 查询结果的含义请参考:http://www.2cto.com/database/201209/156466.html

  7. Java正则表达式的使用和详解(下)

    1.常用正则表达式 规则 正则表达式语法   一个或多个汉字 ^[\u0391-\uFFE5]+$  邮政编码 ^[1-9]\d{5}$ QQ号码 ^[1-9]\d{4,10}$  邮箱 ^[a-zA ...

  8. javascript的闭包计数器实现,python实现各种方法来实现计数器

    菜鸟教程的javascript闭包章节中,演示了js计数器的实现.    教程地址 http://www.runoob.com/js/js-function-closures.html 代码1 var ...

  9. Java实现经理与员工的差异

    对于在同一家公司工作的经历和员工而言,两者是有很多共同点的.例如,每个月都要发工资,但是经理在完成目标任务后,还会获得奖金.此时,利用员工类来编写经理类就会少写很多代码,利用继承技术可以让经理类使用员 ...

  10. Python中的yield和Generators(生成器)

    本文目的 解释yield关键字到底是什么,为什么它是有用的,以及如何来使用它. 协程与子例程 我们调用一个普通的Python函数时,一般是从函数的第一行代码开始执行,结束于return语句.异常或者函 ...