java - Spring 中的WebAsyncManager 有什么應(yīng)用場景?
問題描述


說明:第一張圖片是FrameworkServlet的processRequest方法,
問題:
(1) WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
asyncManager.registerCallableInterceptor(FrameworkServlet.class.getName(), new RequestBindingInterceptor());
這兩行代碼有什么作用
(2)WebAsyncManager 是處理什么問題的,應(yīng)用在什么場景?
前輩、大神不吝指點
問題解答
回答1:這種問題建議查看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.
意思是主要用來管理異步請求的處理。什么時候要用到異步處理呢?就是業(yè)務(wù)邏輯復(fù)雜(或者其他原因),為了避免請求線程阻塞,需要委托給另一個線程的時候。
相關(guān)文章:
1. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””2. boot2docker無法啟動3. docker-compose中volumes的問題4. javascript - mock.js可以存儲數(shù)據(jù)嗎5. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.6. nignx - docker內(nèi)nginx 80端口被占用7. java - SSH框架中寫分頁時service層中不能注入分頁類8. docker api 開發(fā)的端口怎么獲取?9. dockerfile - 為什么docker容器啟動不了?10. node.js - antdesign怎么集合react-redux對input控件進(jìn)行初始化賦值

網(wǎng)公網(wǎng)安備