Why create new thread with startAsync instead of doing work in servlet thread?

后端 未结 2 1304
死守一世寂寞
死守一世寂寞 2020-12-05 21:24

In servlet 3.0 one can use startAsync to put long work in another thread, so that you can free up servlet thread.

Seems that I\'m missing something, because I don\'

2条回答
  •  悲&欢浪女
    2020-12-05 21:52

    With servlet 3.0 you can just keep all asynchronous requests waiting in an ArrayList or a some queue Problem is this. You still need a new thread to process the request and pick up the request to finally send the response. So we free up http threads but have to create some thread to process the request

提交回复
热议问题