【发布时间】:2019-08-14 17:19:46
【问题描述】:
据我了解,调用 resttemplate 的 exchange 方法是在不同的线程上执行的。基本上所有客户端库都在不同的线程上执行。
假设我的 servlet 容器是 tomcat。当向暴露的端点发出请求时,tomcat 线程接收请求,并且请求从同一线程上的控制器层到达服务层。在服务层,我使用 resttemplate 调用了 3rd 方服务。当调用exchange方法时,内部操作在不同的线程上运行并获取操作的结果。
我对此有疑问:
resttemplate 基本上从哪个线程池中获取线程以在不同的线程上执行?
我想知道在不同线程上执行 resttemplate 是否必须对 tomcat 线程池做任何事情。
有人能解释一下吗?
【问题讨论】:
标签: multithreading spring-boot spring-mvc threadpool resttemplate