Improve Javadoc for `setThrowLastExceptionOnExhausted` of `RetryTemplate`
Description
As already reported here, I was too a bit surprised to discover that throwLastExceptionOnExhausted has no effect on stateless retries.
I'm not sure I fully understand the logic behind the current behaviour but it would be nice to, at very least, fix the current javadoc by explicitly mentioning that.
A stateless retry always throw the last exception (if it is an Exception) I think. Isn't that kind of what you want if you are setting that flag anyway?
@dsyer thanks for your reply.
The current behavior for stateless retry seems to be:
throwLastExceptionOnExhausted=true-> last exception is thrownthrowLastExceptionOnExhausted=false-> last exception is thrown
So, in any case, the last exception is always thrown and this means that the flag has no effect on stateless retries.
From a user prospective, I would have somehow expected:
throwLastExceptionOnExhausted=false -> ExhaustedRetryException is thrown.
I see what you mean. I'm not sure why you would want to set it to false in that case (that's the default anyway). Do you have an actual use case. If not, and this is really just a nitpick about the javadocs, then feel free to send a pull request clarifying the situation/
Hello,
I actually have a case where I wanted ExhaustedRetryException to be thrown but couldn't understand why it wasn't.
I created an unique RetryTemplate which was called several times, and I wanted to catch on top of them if my exception came from a RetryTemplate or not.
Would it be possible to make this option works on stateless retry too ?
I'm actually throwing an exception wrapper from a listener as a workaround