@@ -9,7 +9,7 @@ private sealed class GenericRegistry<TResult> : IDisposable, IAsyncDisposable
99 {
1010 private readonly Func < ResiliencePipelineBuilder < TResult > > _activator ;
1111 private readonly ConcurrentDictionary < TKey , Action < ResiliencePipelineBuilder < TResult > , ConfigureBuilderContext < TKey > > > _builders ;
12- private readonly ConcurrentDictionary < TKey , ResiliencePipeline < TResult > > _strategies ;
12+ private readonly ConcurrentDictionary < TKey , ResiliencePipeline < TResult > > _pipelines ;
1313
1414 private readonly Func < TKey , string > _builderNameFormatter ;
1515 private readonly Func < TKey , string > ? _instanceNameFormatter ;
@@ -23,14 +23,14 @@ public GenericRegistry(
2323 {
2424 _activator = activator ;
2525 _builders = new ConcurrentDictionary < TKey , Action < ResiliencePipelineBuilder < TResult > , ConfigureBuilderContext < TKey > > > ( builderComparer ) ;
26- _strategies = new ConcurrentDictionary < TKey , ResiliencePipeline < TResult > > ( strategyComparer ) ;
26+ _pipelines = new ConcurrentDictionary < TKey , ResiliencePipeline < TResult > > ( strategyComparer ) ;
2727 _builderNameFormatter = builderNameFormatter ;
2828 _instanceNameFormatter = instanceNameFormatter ;
2929 }
3030
3131 public bool TryGet ( TKey key , [ NotNullWhen ( true ) ] out ResiliencePipeline < TResult > ? strategy )
3232 {
33- if ( _strategies . TryGetValue ( key , out strategy ) )
33+ if ( _pipelines . TryGetValue ( key , out strategy ) )
3434 {
3535 return true ;
3636 }
@@ -49,37 +49,35 @@ public ResiliencePipeline<TResult> GetOrAdd(TKey key, Action<ResiliencePipelineB
4949 {
5050 var context = new ConfigureBuilderContext < TKey > ( key , _builderNameFormatter ( key ) , _instanceNameFormatter ? . Invoke ( key ) ) ;
5151
52- #if NETCOREAPP3_0_OR_GREATER
53- return _strategies . GetOrAdd ( key , static ( _ , factory ) =>
52+ return _pipelines . GetOrAdd ( key , static ( _ , factory ) =>
5453 {
55- return new ResiliencePipeline < TResult > ( CreatePipelineComponent ( factory . instance . _activator , factory . context , factory . configure ) , DisposeBehavior . Reject ) ;
54+ var component = CreatePipelineComponent ( factory . instance . _activator , factory . context , factory . configure ) ;
55+
56+ return new ResiliencePipeline < TResult > ( component , DisposeBehavior . Reject ) ;
5657 } ,
5758 ( instance : this , context , configure ) ) ;
58- #else
59- return _strategies . GetOrAdd ( key , _ => new ResiliencePipeline < TResult > ( CreatePipelineComponent ( _activator , context , configure ) , DisposeBehavior . Reject ) ) ;
60- #endif
6159 }
6260
6361 public bool TryAddBuilder ( TKey key , Action < ResiliencePipelineBuilder < TResult > , ConfigureBuilderContext < TKey > > configure ) => _builders . TryAdd ( key , configure ) ;
6462
6563 public void Dispose ( )
6664 {
67- foreach ( var strategy in _strategies . Values )
65+ foreach ( var strategy in _pipelines . Values )
6866 {
6967 strategy . DisposeHelper . ForceDispose ( ) ;
7068 }
7169
72- _strategies . Clear ( ) ;
70+ _pipelines . Clear ( ) ;
7371 }
7472
7573 public async ValueTask DisposeAsync ( )
7674 {
77- foreach ( var strategy in _strategies . Values )
75+ foreach ( var strategy in _pipelines . Values )
7876 {
7977 await strategy . DisposeHelper . ForceDisposeAsync ( ) . ConfigureAwait ( false ) ;
8078 }
8179
82- _strategies . Clear ( ) ;
80+ _pipelines . Clear ( ) ;
8381 }
8482 }
8583}
0 commit comments