开发者_StackOverflow
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this questionDo any languages that support retry
constructs in exception handling track and expose the number of times their catch
/rescue
(and/or try
/begin
) blocks have been executed in a particular run?
I find myself counting (and limiting) the number of times a code block is re-executed after an exception often enough that this would be a handy language built-in.
This is a really interesting question. I did a little research and apparently there is a design pattern called the circuit breaker pattern which was developed to handle such things. I have never heard of the pattern before and can't find much information about it.
There is a library which handles retrying an event for .NET available, might be worth a look. Heres a link to an article about it:
http://www.tobinharris.com/past/2009/1/26/net-circuit-breakers/
精彩评论