Skip to content

Commit

Permalink
Add PlaceFinder retry logic for CommunicationException Server Errors.
Browse files Browse the repository at this point in the history
Published to nuget as version 1.7.5.0.
  • Loading branch information
Dan Ludwig authored and Dan Ludwig committed Oct 12, 2012
1 parent 5aa1652 commit e509e9a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -48,6 +48,7 @@ Packages/
!NGeo.1.7.2.0.nupkg
!NGeo.1.7.3.0.nupkg
!NGeo.1.7.4.0.nupkg
!NGeo.1.7.5.0.nupkg

#Ignore local testsettings
Local.testsettings
Expand Down
2 changes: 1 addition & 1 deletion NGeo.Tests/Properties/AssemblyInfo.cs
Expand Up @@ -30,5 +30,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.7.4.*")]
[assembly: AssemblyVersion("1.7.5.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
2 changes: 1 addition & 1 deletion NGeo/NGeo.nuspec
Expand Up @@ -17,7 +17,7 @@
<releaseNotes>
NGeo is a client library that makes it easier to invoke
GeoNames, Yahoo! GeoPlanet, and Yahoo! PlaceFinder services from .NET code.
Version 1.7.4 adds retry logic to the Geonames service when underlying connections are unexpectedly closed by the server.
Version 1.7.5 adds retry logic to the PlaceFinder service when ServiceModel.CommunicationException ("Server Error") exceptions are thrown.
</releaseNotes>
<copyright>Copyright © UCosmic Consortium 2012</copyright>
<tags>GeoNames, GeoPlanet, PlaceFinder, Yahoo</tags>
Expand Down
2 changes: 1 addition & 1 deletion NGeo/Properties/AssemblyInfo.cs
Expand Up @@ -35,6 +35,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.4.*")]
[assembly: AssemblyVersion("1.7.5.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

48 changes: 42 additions & 6 deletions NGeo/Yahoo/PlaceFinder/PlaceFinderClient.cs
Expand Up @@ -29,7 +29,13 @@ private Response ChannelFindByCoordinates(PlaceByCoordinates request, int retry
}
catch (ProtocolException ex)
{
if (retry < RetryLimit && ex.InnerException != null && ex.InnerException is WebException)
if (retry < RetryLimit && ex.InnerException is WebException)
return ChannelFindByCoordinates(request, ++retry);
throw;
}
catch (CommunicationException ex)
{
if (retry < RetryLimit && ex.Message == "Server Error")
return ChannelFindByCoordinates(request, ++retry);
throw;
}
Expand All @@ -56,7 +62,13 @@ private Response ChannelFindByFreeformText(PlaceByFreeformText request, int retr
}
catch (ProtocolException ex)
{
if (retry < RetryLimit && ex.InnerException != null && ex.InnerException is WebException)
if (retry < RetryLimit && ex.InnerException is WebException)
return ChannelFindByFreeformText(request, ++retry);
throw;
}
catch (CommunicationException ex)
{
if (retry < RetryLimit && ex.Message == "Server Error")
return ChannelFindByFreeformText(request, ++retry);
throw;
}
Expand All @@ -83,7 +95,13 @@ private Response ChannelFindByName(PlaceByName request, int retry = 0)
}
catch (ProtocolException ex)
{
if (retry < RetryLimit && ex.InnerException != null && ex.InnerException is WebException)
if (retry < RetryLimit && ex.InnerException is WebException)
return ChannelFindByName(request, ++retry);
throw;
}
catch (CommunicationException ex)
{
if (retry < RetryLimit && ex.Message == "Server Error")
return ChannelFindByName(request, ++retry);
throw;
}
Expand All @@ -110,7 +128,13 @@ private Response ChannelFindByWoeId(PlaceByWoeId request, int retry = 0)
}
catch (ProtocolException ex)
{
if (retry < RetryLimit && ex.InnerException != null && ex.InnerException is WebException)
if (retry < RetryLimit && ex.InnerException is WebException)
return ChannelFindByWoeId(request, ++retry);
throw;
}
catch (CommunicationException ex)
{
if (retry < RetryLimit && ex.Message == "Server Error")
return ChannelFindByWoeId(request, ++retry);
throw;
}
Expand Down Expand Up @@ -138,7 +162,13 @@ private Response ChannelFindByMultilineAddress(PlaceByMultilineAddress request,
}
catch (ProtocolException ex)
{
if (retry < RetryLimit && ex.InnerException != null && ex.InnerException is WebException)
if (retry < RetryLimit && ex.InnerException is WebException)
return ChannelFindByMultilineAddress(request, ++retry);
throw;
}
catch (CommunicationException ex)
{
if (retry < RetryLimit && ex.Message == "Server Error")
return ChannelFindByMultilineAddress(request, ++retry);
throw;
}
Expand Down Expand Up @@ -168,7 +198,13 @@ private Response ChannelFindByFullyParsedAddress(PlaceByFullyParsedAddress reque
}
catch (ProtocolException ex)
{
if (retry < RetryLimit && ex.InnerException != null && ex.InnerException is WebException)
if (retry < RetryLimit && ex.InnerException is WebException)
return ChannelFindByFullyParsedAddress(request, ++retry);
throw;
}
catch (CommunicationException ex)
{
if (retry < RetryLimit && ex.Message == "Server Error")
return ChannelFindByFullyParsedAddress(request, ++retry);
throw;
}
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
@@ -1,3 +1,6 @@
1.7.5
- Add retry logic to PlaceFinder client when ServiceModel.CommunicationException ("Server Error") is thrown.

1.7.4
- Add retry logic to Geonames client when underlying connection (expected to be kept alive) is unexpectedly closed by the server.

Expand Down
Binary file added nupkgs/NGeo.1.7.5.0.nupkg
Binary file not shown.

0 comments on commit e509e9a

Please sign in to comment.