Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Async Servlet  RSS feed

Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello dear ranchers hear is my question,

Trying to understand the Async Servlet for a few days now, no luck yet. May be you could help me. So, what literally happens when we call startAsync()? The request and the response gets somehow put on the server, while the "async" job gets done? For example:

AsyncContext context = request.startAsync();
context.start(new Runnable() {
public void run() {
try {
} catch (InterruptedException e) {

So, what this means is that the initial http Thread "releases" the request, some other worker thread picks it up and does the waiting (the async task) and the the http Thread builds the response.

I mean, from what I have read so far, the async support is for releasing some Thread, right? But if we release some Thread, the async job is done by some other Thread anyway. So, where do we win in the first place? Or may be some Threads are not that expensive as others?

P.S. There are no stupid questions, there are silly answers.

Thanks a lot!

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!