Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

when is the AsyncContext.complete method called when dispatching request to the container ?

 
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer servlet 3.0 specifications , section 2.3.3.3 asynchronous processing page 3. following is a paragraph from the above section

Dispatching from a servlet that has asyncSupported=true to one where
asyncSupported is set to false is allowed. In this case, the response will be
committed when the service method of the servlet that does not support async is
exited, and it is the container's responsibility to call complete on the
AsyncContext so that any interested AsyncListener instances will be notified.
The AsyncListener.onComplete notification should also be used by filters as a
mechanism to clear up resources that it has been holding on to for the async task to
complete.



my question is that suppose i have an asynchronous servlet that dispatches request to a jsp page. now suppose my long running process has completed and i called dispatch method and forwarded the request and response objects to the jsp page. now as the above paragraph says that response will be committed when the service method of the servlet that does not support async is exited(here jsp page will result in servlet). my question is that when will be AsyncContext.complete will be called ? before calling dispatch or after calling dispatch or after calling dispatch but before committing response or after committing response?
 
There's a city wid manhunt for this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic