[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

Retry Mechanism

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
directxBOB
Asked:
directxBOB
1 Solution
 
dkloeckCommented:
int retryTimes = 3;
while(retryTimes>0)
{
try
{
..try logic..

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now