SpringBoot Undertow : how to dispatch to worker thread

前端 未结 1 758
不思量自难忘°
不思量自难忘° 2021-01-23 15:14

i\'m currently have a look a springboot undertow and it\'s not really clear (for me) how to dispatch an incoming http request to a worker thread for blocking operation handling.

相关标签:
1条回答
  • 2021-01-23 15:24

    You don't need to do anything.

    Spring Boot's default Undertow configuration uses Undertow's ServletInitialHandler in front of Spring MVC's DispatcherServlet. This handler performs the exchange.isInIoThread() check and calls dispatch() if necessary.

    If you place a breakpoint in your @Controller, you'll see that it's called on a thread named XNIO-1 task-n which is a worker thread (the IO threads are named XNIO-1 I/O-n).

    0 讨论(0)
提交回复
热议问题