Home  >  Q&A  >  body text

java - What are the application scenarios of WebAsyncManager in Spring?

Description: The first picture is the processRequest method of FrameworkServlet,

question:

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

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

What do these two lines of code do?

(2) What problems does WebAsyncManager solve and what scenarios is it used in?

Seniors and masters don’t hesitate to give pointers

曾经蜡笔没有小新曾经蜡笔没有小新2713 days ago687

reply all(1)I'll reply

  • 迷茫

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

    For this kind of problem, it is recommended to check the official Spring documentation
    WebAsyncManager http://docs.spring.io/spring/...

    There is a paragraph in the middle:

    The central class for managing asynchronous request processing, mainly intended as an SPI and not typically used directly by application classes.

    It means it is mainly used to manage the processing of asynchronous requests. When should asynchronous processing be used? It is when the business logic is complex (or for other reasons) and in order to avoid blocking the request thread, it needs to be delegated to another thread.

    reply
    0
  • Cancelreply