Issue
I am using spring-retry v1.3.1 with @Retryable annotation and I have a few questions on its behaviour. Let's say that in my spring boot application I have a retry configuration that makes my application wait 1 hour before retrying. If my application is killed (for example by kubernetes) while it was waiting in order to do a retry is there a way to catch it and do some operations before shutting down (logging for example)? Also I'm not sure how spring-retry is using threads, if I end up with many retry attempts is there a risk that it blocks the application because of too many threads? Is there a way to give a dedicate thread pool to retryable?
Solution
When interrupted, a BackOffInterruptedException
is thrown to the caller so you can catch that.
spring-retry
itself does not manage threads; that's up to you.
It is completely thread-based so, yes, you can end up with many suspended threads unless you manage the work with, for example, a ThreadPoolTaskExecutor
.
Answered By - Gary Russell
Answer Checked By - Marilyn (JavaFixing Volunteer)