Solved

Retry Mechanism

Posted on 2007-11-26
1
395 Views
Last Modified: 2010-04-15
I was wondering if anyone knew of any good retry strategies?

I have alot of try catch blocks, database calls, external webservice calls and I want to make my webservice more robust.

So when a try catch is hit, it would retry 3 more times. Catches are usually hit as a result of a bad database connection or external webservice not being available. I would like the ability to retry.

I was thinking of having a global reference and when it fails it would increment the reference variable and recursively call itself. But this approach could cause more hassle than it's worth.

Are there any good articles, samples, examples or has anyone got any good ideas on this?
0
Comment
Question by:directxBOB
1 Comment
 
LVL 10

Accepted Solution

by:
dkloeck earned 500 total points
Comment Utility
int retryTimes = 3;
while(retryTimes>0)
{
try
{
..try logic..

retryTimes=0; //or just break;
}
catch
{
..catch logic..
}
retryTimes--;
}
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now