原文链接:https://segmentfault.com/q/1010000009403867
在springmvc的DispatcherServlet的doDispatch中有这一行:
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
那么WebAsyncManager 的作用是什么?
这种问题建议查看Spring官方文档
WebAsyncManager http://docs.spring.io/spring/... 或 点击打开链接
中间有一段:
The central class for managing asynchronous request processing, mainly intended as an SPI and not typically used directly by application classes.
意思是主要用来管理异步请求的处理。什么时候要用到异步处理呢?就是业务逻辑复杂(或者其他原因),为了避免请求线程阻塞,需要委托给另一个线程的时候。