首頁  >  問答  >  主體

java - Spring 中的WebAsyncManager 有什麼應用場景?

##說明:第一張圖片是FrameworkServlet的processRequest方法,

問題:

(1) WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);

    asyncManager.registerCallableInterceptor(FrameworkServlet.class.getName(), new RequestBindingInterceptor());

這兩行程式碼有什麼作用

(2)WebAsyncManager 是處理什麼問題的,應用在什麼場景?

前輩、大神不吝指點

曾经蜡笔没有小新曾经蜡笔没有小新2713 天前698

全部回覆(1)我來回復

  • 迷茫

    迷茫2017-05-17 10:01:17

    這種問題建議查看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.

    意思是主要用來管理非同步請求的處理。什麼時候要用到非同步處理呢?就是業務邏輯複雜(或其他原因),為了避免請求執行緒阻塞,需要委託給另一個執行緒的時候。

    回覆
    0
  • 取消回覆