Solved

Retry Mechanism

Posted on 2007-11-26
1
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

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

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

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

719 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