0

在以下示例中,我尝试将请求暂停 2 分钟。似乎默认的 HTTP 请求连接超时为 1 分钟。如果我必须执行以下任务,怎么可能?

@RestController
public class MainController {
    @GetMapping("/home")
    public void testMethod() throws InterruptedException {
        System.out.println("Inside the controller before thread sleep.");
        Thread.sleep(120000); //Sleeping the server for 2 minutes
        System.out.println("After the thread sleep.");
    }
}

我确实尝试在standalone.xml中将诸如default-connection-timeout之类的值添加到12000,但无法实现任何目标。

4

0 回答 0