文章詳情頁
java - Spring 中的WebAsyncManager 有什么應用場景?
瀏覽:100日期:2023-12-15 14:32:18
問題描述
說明:第一張圖片是FrameworkServlet的processRequest方法,
問題:
(1) WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
asyncManager.registerCallableInterceptor(FrameworkServlet.class.getName(), new RequestBindingInterceptor());
這兩行代碼有什么作用
(2)WebAsyncManager 是處理什么問題的,應用在什么場景?
前輩、大神不吝指點
問題解答
回答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.
意思是主要用來管理異步請求的處理。什么時候要用到異步處理呢?就是業務邏輯復雜(或者其他原因),為了避免請求線程阻塞,需要委托給另一個線程的時候。
標簽:
java
相關文章:
排行榜
