Skip to content

Commit d09f162

Browse files
committed
Docs
1 parent 9f158f8 commit d09f162

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/Polly.Core/Registry/ResiliencePipelineProvider.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public abstract class ResiliencePipelineProvider<TKey>
1717
/// <param name="key">The key used to identify the resilience pipeline.</param>
1818
/// <returns>The resilience pipeline associated with the specified key.</returns>
1919
/// <exception cref="KeyNotFoundException">Thrown when no resilience pipeline is found for the specified key.</exception>
20+
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
2021
public virtual ResiliencePipeline GetPipeline(TKey key)
2122
{
2223
if (TryGetPipeline(key, out var pipeline))
@@ -35,6 +36,7 @@ public virtual ResiliencePipeline GetPipeline(TKey key)
3536
/// <param name="key">The key used to identify the resilience pipeline.</param>
3637
/// <returns>The resilience pipeline associated with the specified key.</returns>
3738
/// <exception cref="KeyNotFoundException">Thrown when no resilience pipeline is found for the specified key.</exception>
39+
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
3840
public virtual ResiliencePipeline<TResult> GetPipeline<TResult>(TKey key)
3941
{
4042
if (TryGetPipeline<TResult>(key, out var pipeline))
@@ -52,6 +54,7 @@ public virtual ResiliencePipeline<TResult> GetPipeline<TResult>(TKey key)
5254
/// <param name="key">The key used to identify the resilience pipeline.</param>
5355
/// <param name="pipeline">The output resilience pipeline if found, <see langword="null"/> otherwise.</param>
5456
/// <returns><see langword="true"/> if the pipeline was found, <see langword="false"/> otherwise.</returns>
57+
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
5558
public abstract bool TryGetPipeline(TKey key, [NotNullWhen(true)] out ResiliencePipeline? pipeline);
5659

5760
/// <summary>
@@ -61,5 +64,6 @@ public virtual ResiliencePipeline<TResult> GetPipeline<TResult>(TKey key)
6164
/// <param name="key">The key used to identify the resilience pipeline.</param>
6265
/// <param name="pipeline">The output resilience pipeline if found, <see langword="null"/> otherwise.</param>
6366
/// <returns><see langword="true"/> if the pipeline was found, <see langword="false"/> otherwise.</returns>
67+
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
6468
public abstract bool TryGetPipeline<TResult>(TKey key, [NotNullWhen(true)] out ResiliencePipeline<TResult>? pipeline);
6569
}

src/Polly.Core/Registry/ResiliencePipelineRegistry.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public override bool TryGetPipeline(TKey key, [NotNullWhen(true)] out Resilience
9595
/// <param name="key">The key used to identify the resilience pipeline.</param>
9696
/// <param name="configure">The callback that configures the pipeline builder.</param>
9797
/// <returns>An instance of pipeline.</returns>
98+
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
9899
public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBuilder> configure)
99100
{
100101
Guard.NotNull(configure);
@@ -110,6 +111,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBu
110111
/// <param name="key">The key used to identify the resilience pipeline.</param>
111112
/// <param name="configure">The callback that configures the pipeline builder.</param>
112113
/// <returns>An instance of pipeline.</returns>
114+
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
113115
public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBuilder, ConfigureBuilderContext<TKey>> configure)
114116
{
115117
Guard.NotNull(configure);
@@ -141,6 +143,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBu
141143
/// <param name="key">The key used to identify the resilience pipeline.</param>
142144
/// <param name="configure">The callback that configures the pipeline builder.</param>
143145
/// <returns>An instance of pipeline.</returns>
146+
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
144147
public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<ResiliencePipelineBuilder<TResult>> configure)
145148
{
146149
Guard.NotNull(configure);
@@ -157,6 +160,7 @@ public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<Re
157160
/// <param name="key">The key used to identify the resilience pipeline.</param>
158161
/// <param name="configure">The callback that configures the pipeline builder.</param>
159162
/// <returns>An instance of pipeline.</returns>
163+
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
160164
public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<ResiliencePipelineBuilder<TResult>, ConfigureBuilderContext<TKey>> configure)
161165
{
162166
Guard.NotNull(configure);
@@ -176,6 +180,7 @@ public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<Re
176180
/// Use this method when you want to create the pipeline on-demand when it's first accessed.
177181
/// </remarks>
178182
/// <exception cref="ArgumentNullException">Thrown when <paramref name="configure"/> is <see langword="null"/>.</exception>
183+
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
179184
public bool TryAddBuilder(TKey key, Action<ResiliencePipelineBuilder, ConfigureBuilderContext<TKey>> configure)
180185
{
181186
Guard.NotNull(configure);
@@ -196,6 +201,7 @@ public bool TryAddBuilder(TKey key, Action<ResiliencePipelineBuilder, ConfigureB
196201
/// Use this method when you want to create the pipeline on-demand when it's first accessed.
197202
/// </remarks>
198203
/// <exception cref="ArgumentNullException">Thrown when <paramref name="configure"/> is <see langword="null"/>.</exception>
204+
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
199205
public bool TryAddBuilder<TResult>(TKey key, Action<ResiliencePipelineBuilder<TResult>, ConfigureBuilderContext<TKey>> configure)
200206
{
201207
Guard.NotNull(configure);
@@ -205,7 +211,13 @@ public bool TryAddBuilder<TResult>(TKey key, Action<ResiliencePipelineBuilder<TR
205211
return GetGenericRegistry<TResult>().TryAddBuilder(key, configure);
206212
}
207213

208-
/// <inheritdoc/>
214+
/// <summary>
215+
/// Disposes all resources that are held by the resilience pipelines created by this builder.
216+
/// </summary>
217+
/// <remarks>
218+
/// After the disposal, all resilience pipelines still used outside of the builder are disposed
219+
/// and cannot be used anymore.
220+
/// </remarks>
209221
public void Dispose()
210222
{
211223
_disposed = true;
@@ -225,7 +237,14 @@ public void Dispose()
225237
_genericRegistry.Clear();
226238
}
227239

228-
/// <inheritdoc/>
240+
/// <summary>
241+
/// Disposes all resources that are held by the resilience pipelines created by this builder.
242+
/// </summary>
243+
/// <returns>Returns a task that represents the asynchronous dispose operation.</returns>
244+
/// <remarks>
245+
/// After the disposal, all resilience pipelines still used outside of the builder are disposed
246+
/// and cannot be used anymore.
247+
/// </remarks>
229248
public async ValueTask DisposeAsync()
230249
{
231250
_disposed = true;

0 commit comments

Comments
 (0)