当前位置:   article > 正文

spring.mvc.async.request-timeout 配置无用

spring.mvc.async.request-timeout

配置

spring.mvc.async.request-timeout=20000

代码

  1. @GetMapping("test")
  2. public String test(){
  3. try {
  4. Thread.sleep(60000);
  5. } catch (InterruptedException e) {
  6. e.printStackTrace();
  7. }
  8. System.out.println("keep going");
  9. return "success";
  10. }
  11. @GetMapping("test2")
  12. public Callable<String> test2() {
  13. return ()-> {
  14. try {
  15. Thread.sleep(60000);
  16. } catch (InterruptedException e) {
  17. e.printStackTrace();
  18. }
  19. System.out.println("keep going");
  20. return "foobar";
  21. };
  22. }

解析

test不生效  test2生效

看看解释,异步请求到达之前的时间量 

当20秒到了,程序睡眠中断。实际就是程序直接跳出

返回503 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/神奇cpp/article/detail/849882
推荐阅读
相关标签
  

闽ICP备14008679号