Solved

Retry Mechanism

Posted on 2007-11-26
1
400 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MailAddress in vb 4 36
Trying to understand what this mean...types(lstTypes[i].AvailableDatatype) 2 27
WPF Select Items 3 27
Need help with another query 10 39
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…

726 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