What happens with @Async. Is this a timeout?

Say that I have a call to the @Async method that hangs. Will it be a timeout? What is best used to free up your resources?

+4
source share
1 answer

@Async method calls are made in a specific thread pool. If your method freezes, it will keep one thread from the pool indefinitely. Spring can't do anything about it.

If your method is kind enough to accept an InterruptedException , you can Future.cancel() it off by calling Future.cancel() value returned from the asynchronous method.

+2
source

Source: https://habr.com/ru/post/1445736/


All Articles