Delaying an exception

I have a method that periodically (e.g. once in every 10 secs) try to connect to a server and read some data from it. The server might not be available all the time. If the server is not available the method throws an exception.

What would be the best way to implement a wrapper method that doesn't throw an exception except if the server wasn't available for at least one minute?


Keep track of when the last time you successfully reached the server was. If the server throws an exception, catch it and compare to the last time you reached the server. If that time is more than a minute, rethrow the exception.

Need Your Help

Loading 3D objects and textures for OpenGL ES rendering

android ios opengl-es 3d .obj

I have some 3D objects stored in 3D editor application specific (Blender/Solid/3DS) file format exported to OBJ+MTL files with optional textures in PNG/JPG files.

Cocoa Open source XML parser

xml cocoa open-source rss

I'm looking for an open source XML parser that is easy to integrate with my NSTableView and will handle large amounts of RSS feeds

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.