I’m stuck with this requirement that I need to try X times before calling it quits.
I personally prefer to fail and notify immediately but hey…
So…
for retries
try
connect
exececute sql
process sql
commit
if all is good break loop
catch
rollback
With what exceptions should you retry vs not retry? On a connection drop I figure yes. But if everything is an SQLException how do you differentiate when you should and not? Or should I just retry period?
Have a count variable. It doesn’t make sense to loop through there for lifelong. Have certain tries count. If all is good (or) reached count, break loop. This is what I prefer.