Spring RestTemplate not allowing cancel / InterruptedException

后端 未结 1 1115
猫巷女王i
猫巷女王i 2021-01-26 01:57

I have a process that uses RestTemplate to call getForObject. This task is submitted to an executor service. I allow the process x seconds of run time

相关标签:
1条回答
  • 2021-01-26 02:13

    I'm not familiar with the RestTemplate class, but it sound like you have a non-interruptable blocking call. This means that canceling the future or interrupting the thread won't have any effect. The only solution that I know of in this case is to use the deprecated Thread.terminate() method to kill the thread. Please note that you have to be VERY careful doing this because it can leave your object in an invalid state.

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