From d09f162c34fd15d02c328433a2bad6b232fffcb9 Mon Sep 17 00:00:00 2001 From: Martin Tomka Date: Thu, 17 Aug 2023 12:52:38 +0200 Subject: [PATCH] Docs --- .../Registry/ResiliencePipelineProvider.cs | 4 ++++ .../Registry/ResiliencePipelineRegistry.cs | 23 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Polly.Core/Registry/ResiliencePipelineProvider.cs b/src/Polly.Core/Registry/ResiliencePipelineProvider.cs index e6bdfb3679c..1cd26d653c7 100644 --- a/src/Polly.Core/Registry/ResiliencePipelineProvider.cs +++ b/src/Polly.Core/Registry/ResiliencePipelineProvider.cs @@ -17,6 +17,7 @@ public abstract class ResiliencePipelineProvider /// The key used to identify the resilience pipeline. /// The resilience pipeline associated with the specified key. /// Thrown when no resilience pipeline is found for the specified key. + /// Thrown when the provider is already disposed. public virtual ResiliencePipeline GetPipeline(TKey key) { if (TryGetPipeline(key, out var pipeline)) @@ -35,6 +36,7 @@ public virtual ResiliencePipeline GetPipeline(TKey key) /// The key used to identify the resilience pipeline. /// The resilience pipeline associated with the specified key. /// Thrown when no resilience pipeline is found for the specified key. + /// Thrown when the provider is already disposed. public virtual ResiliencePipeline GetPipeline(TKey key) { if (TryGetPipeline(key, out var pipeline)) @@ -52,6 +54,7 @@ public virtual ResiliencePipeline GetPipeline(TKey key) /// The key used to identify the resilience pipeline. /// The output resilience pipeline if found, otherwise. /// if the pipeline was found, otherwise. + /// Thrown when the provider is already disposed. public abstract bool TryGetPipeline(TKey key, [NotNullWhen(true)] out ResiliencePipeline? pipeline); /// @@ -61,5 +64,6 @@ public virtual ResiliencePipeline GetPipeline(TKey key) /// The key used to identify the resilience pipeline. /// The output resilience pipeline if found, otherwise. /// if the pipeline was found, otherwise. + /// Thrown when the provider is already disposed. public abstract bool TryGetPipeline(TKey key, [NotNullWhen(true)] out ResiliencePipeline? pipeline); } diff --git a/src/Polly.Core/Registry/ResiliencePipelineRegistry.cs b/src/Polly.Core/Registry/ResiliencePipelineRegistry.cs index be8f57cf51c..61eb0e1f7e8 100644 --- a/src/Polly.Core/Registry/ResiliencePipelineRegistry.cs +++ b/src/Polly.Core/Registry/ResiliencePipelineRegistry.cs @@ -95,6 +95,7 @@ public override bool TryGetPipeline(TKey key, [NotNullWhen(true)] out Resilience /// The key used to identify the resilience pipeline. /// The callback that configures the pipeline builder. /// An instance of pipeline. + /// Thrown when the registry is already disposed. public ResiliencePipeline GetOrAddPipeline(TKey key, Action configure) { Guard.NotNull(configure); @@ -110,6 +111,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, ActionThe key used to identify the resilience pipeline. /// The callback that configures the pipeline builder. /// An instance of pipeline. + /// Thrown when the registry is already disposed. public ResiliencePipeline GetOrAddPipeline(TKey key, Action> configure) { Guard.NotNull(configure); @@ -141,6 +143,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, ActionThe key used to identify the resilience pipeline. /// The callback that configures the pipeline builder. /// An instance of pipeline. + /// Thrown when the registry is already disposed. public ResiliencePipeline GetOrAddPipeline(TKey key, Action> configure) { Guard.NotNull(configure); @@ -157,6 +160,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, ActionThe key used to identify the resilience pipeline. /// The callback that configures the pipeline builder. /// An instance of pipeline. + /// Thrown when the registry is already disposed. public ResiliencePipeline GetOrAddPipeline(TKey key, Action, ConfigureBuilderContext> configure) { Guard.NotNull(configure); @@ -176,6 +180,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, Action /// Thrown when is . + /// Thrown when the registry is already disposed. public bool TryAddBuilder(TKey key, Action> configure) { Guard.NotNull(configure); @@ -196,6 +201,7 @@ public bool TryAddBuilder(TKey key, Action /// Thrown when is . + /// Thrown when the registry is already disposed. public bool TryAddBuilder(TKey key, Action, ConfigureBuilderContext> configure) { Guard.NotNull(configure); @@ -205,7 +211,13 @@ public bool TryAddBuilder(TKey key, Action().TryAddBuilder(key, configure); } - /// + /// + /// Disposes all resources that are held by the resilience pipelines created by this builder. + /// + /// + /// After the disposal, all resilience pipelines still used outside of the builder are disposed + /// and cannot be used anymore. + /// public void Dispose() { _disposed = true; @@ -225,7 +237,14 @@ public void Dispose() _genericRegistry.Clear(); } - /// + /// + /// Disposes all resources that are held by the resilience pipelines created by this builder. + /// + /// Returns a task that represents the asynchronous dispose operation. + /// + /// After the disposal, all resilience pipelines still used outside of the builder are disposed + /// and cannot be used anymore. + /// public async ValueTask DisposeAsync() { _disposed = true;