The request associated with the Asynccontext have already completed processing

Source: Internet
Author: User

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

Java.lang.IllegalStateException:The request associated with the Asynccontext have 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 was because asynchronous processing time servlet The default is ten seconds, apparently Bec Ause the data is too large, resulting.

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

Asynccontext.settimeout (900000000);

For asynchronous loading manual Setting the timeout can is, 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 is not being blocked, but directly to the execution        //business Pro Cessing after the completion of the response by the Asynccontext management asynccontext        asynccontext = Request.starta Sync ();        Asynccontext.settimeout (900000000);        Producthandlethread producthandlethread = new Producthandlethread (Asynccontext,request.getsession ());        Asynccontext.start (Producthandlethread);}

  

The request associated with the Asynccontext have already completed processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.