?
Solved

Retry Mechanism

Posted on 2007-11-26
1
Medium Priority
?
402 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 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