Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Profile78 v4.5 portable class library #4

Merged
merged 3 commits into from
Mar 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Polly.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Net35", "src\Polly.Net35\Polly.Net35.csproj", "{839C8F41-292D-486C-815B-ACE7F03467E3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{67DE5201-A735-4C13-B528-488231ED01A8}"
Expand All @@ -27,6 +29,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DBE00D
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Net45", "src\Polly.Net45\Polly.Net45.csproj", "{29265540-F724-4324-9321-643A0FCB133F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Pcl", "src\Polly.Pcl\Polly.Pcl.csproj", "{905CF38A-BE90-4234-BF15-2FCFD1973A9C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -49,6 +53,10 @@ Global
{29265540-F724-4324-9321-643A0FCB133F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29265540-F724-4324-9321-643A0FCB133F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29265540-F724-4324-9321-643A0FCB133F}.Release|Any CPU.Build.0 = Release|Any CPU
{905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{905CF38A-BE90-4234-BF15-2FCFD1973A9C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Binary file modified README.md

Polly

Polly is a .NET 3.5 / 4.0 / 4.5 / PCL library that allows developers to express transient exception handling policies such as Retry, Retry Forever, Wait and Retry or Circuit Breaker in a fluent manner.

Acknowledgements

  • lokad-shared-libraries - Helper assemblies for .NET 3.5 and Silverlight 2.0 that are being developed as part of the Open Source effort by Lokad.com (discontinued) | New BSD License
  • @ghuntley - Contributed Portable Class Library implementation.

License

Licensed under the terms of the New BSD License

Binary file not shown.
4 changes: 4 additions & 0 deletions src/Polly.Net35/CircuitBreaker/BrokenCircuitException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ namespace Polly.CircuitBreaker
/// <summary>
/// Exception thrown when a circuit is broken.
/// </summary>
#if !PORTABLE
[Serializable]
#endif
public class BrokenCircuitException : Exception
{
/// <summary>
Expand All @@ -33,6 +35,7 @@ public BrokenCircuitException(string message, Exception inner) : base(message, i
{
}

#if !PORTABLE
/// <summary>
/// Initializes a new instance of the <see cref="BrokenCircuitException"/> class.
/// </summary>
Expand All @@ -43,5 +46,6 @@ protected BrokenCircuitException(
StreamingContext context) : base(info, context)
{
}
#endif
}
}
17 changes: 15 additions & 2 deletions src/Polly.Net35/Utilities/SystemClock.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using System;
using System.Threading;

#if PORTABLE
using System.Threading.Tasks;
#endif

namespace Polly.Utilities
{
/// <summary>
Expand All @@ -12,8 +16,12 @@ public static class SystemClock
/// Allows the setting of a custom Thread.Sleep implementation for testing.
/// By default this will be a call to <see cref="Thread.Sleep(TimeSpan)"/>
/// </summary>
#if !PORTABLE
public static Action<TimeSpan> Sleep = Thread.Sleep;

#endif
#if PORTABLE
public static Action<TimeSpan> Sleep = async span => await Task.Delay(span);
#endif
/// <summary>
/// Allows the setting of a custom DateTime.UtcNow implementation for testing.
/// By default this will be a call to <see cref="DateTime.UtcNow"/>
Expand All @@ -26,7 +34,12 @@ public static class SystemClock
/// </summary>
public static void Reset()
{
Sleep = Thread.Sleep;
#if !PORTABLE
Sleep = Thread.Sleep;
#endif
#if PORTABLE
Sleep = span => Task.Delay(span);
#endif
UtcNow = () => DateTime.UtcNow;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/Polly.Net35/Utilities/TimedLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ private class Sentinel
// If this finalizer runs, someone somewhere failed to
// call Dispose, which means we've failed to leave
// a monitor!
#if !PORTABLE
System.Diagnostics.Debug.Fail("Undisposed lock");
#endif
}
}
private Sentinel leakDetector;
Expand Down
121 changes: 121 additions & 0 deletions src/Polly.Pcl/Polly.Pcl.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{905CF38A-BE90-4234-BF15-2FCFD1973A9C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Polly</RootNamespace>
<AssemblyName>Polly</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\Polly.Net45\Polly.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\SolutionAssemblyInfo.cs">
<Link>Properties\SolutionAssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\..\SolutionVersion.cs">
<Link>Properties\SolutionVersion.cs</Link>
</Compile>
<Compile Include="..\Polly.Net35\CircuitBreakerSyntax.cs">
<Link>CircuitBreakerSyntax.cs</Link>
</Compile>
<Compile Include="..\polly.net35\circuitbreaker\BrokenCircuitException.cs">
<Link>CircuitBreaker\BrokenCircuitException.cs</Link>
</Compile>
<Compile Include="..\polly.net35\circuitbreaker\CircuitBreakerPolicy.cs">
<Link>CircuitBreaker\CircuitBreakerPolicy.cs</Link>
</Compile>
<Compile Include="..\polly.net35\circuitbreaker\CircuitBreakerState.cs">
<Link>CircuitBreaker\CircuitBreakerState.cs</Link>
</Compile>
<Compile Include="..\polly.net35\circuitbreaker\ICircuitBreakerState.cs">
<Link>CircuitBreaker\ICircuitBreakerState.cs</Link>
</Compile>
<Compile Include="..\Polly.Net35\ContextualPolicy.cs">
<Link>ContextualPolicy.cs</Link>
</Compile>
<Compile Include="..\Polly.Net35\ExceptionPredicate.cs">
<Link>ExceptionPredicate.cs</Link>
</Compile>
<Compile Include="..\Polly.Net35\OrSyntax.cs">
<Link>OrSyntax.cs</Link>
</Compile>
<Compile Include="..\Polly.Net35\Policy.cs">
<Link>Policy.cs</Link>
</Compile>
<Compile Include="..\Polly.Net35\PolicyBuilder.cs">
<Link>PolicyBuilder.cs</Link>
</Compile>
<Compile Include="..\Polly.Net35\RetrySyntax.cs">
<Link>RetrySyntax.cs</Link>
</Compile>
<Compile Include="..\polly.net35\retry\IRetryPolicyState.cs">
<Link>Retry\IRetryPolicyState.cs</Link>
</Compile>
<Compile Include="..\polly.net35\retry\RetryPolicy.cs">
<Link>Retry\RetryPolicy.cs</Link>
</Compile>
<Compile Include="..\polly.net35\retry\RetryPolicyState.cs">
<Link>Retry\RetryPolicyState.cs</Link>
</Compile>
<Compile Include="..\polly.net35\retry\RetryPolicyStateWithCount.cs">
<Link>Retry\RetryPolicyStateWithCount.cs</Link>
</Compile>
<Compile Include="..\polly.net35\retry\RetryPolicyStateWithSleep.cs">
<Link>Retry\RetryPolicyStateWithSleep.cs</Link>
</Compile>
<Compile Include="..\polly.net35\utilities\SystemClock.cs">
<Link>Utilities\SystemClock.cs</Link>
</Compile>
<Compile Include="..\polly.net35\utilities\TimedLock.cs">
<Link>Utilities\TimedLock.cs</Link>
</Compile>
<Compile Include="..\Polly.Net45\Context.cs">
<Link>Context.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\Polly.Net45\Polly.snk">
<Link>Polly.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
2 changes: 2 additions & 0 deletions src/Polly.Pcl/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
using System.Reflection;
[assembly: AssemblyTitle("Polly")]
15 changes: 9 additions & 6 deletions src/Polly.Specs/Polly.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Polly.snk</AssemblyOriginatorKeyFile>
Expand Down Expand Up @@ -70,14 +70,17 @@
<Compile Include="WaitAndRetrySpecs.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Polly.Net45\Polly.Net45.csproj">
<Project>{29265540-f724-4324-9321-643a0fcb133f}</Project>
<Name>Polly.Net45</Name>
<None Include="packages.config" />
<None Include="Polly.snk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Polly.Pcl\Polly.Pcl.csproj">
<Project>{905cf38a-be90-4234-bf15-2fcfd1973a9c}</Project>
<Name>Polly.Pcl</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Polly.snk" />
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
Expand Down