Table of Contents

Class ResilienceContextPool

Namespace
Polly
Assembly
Polly.Core.dll

The pool of ResilienceContext instances.

public abstract class ResilienceContextPool
Inheritance
ResilienceContextPool
Inherited Members

Properties

Shared

Gets the shared pool instance.

public static ResilienceContextPool Shared { get; }

Property Value

ResilienceContextPool

Methods

Get(ResilienceContextCreationArguments)

Gets a ResilienceContext instance from the pool.

public abstract ResilienceContext Get(ResilienceContextCreationArguments arguments)

Parameters

arguments ResilienceContextCreationArguments

The creation arguments.

Returns

ResilienceContext

An instance of ResilienceContext.

Remarks

After the execution is finished you should return the ResilienceContext back to the pool by calling Return(ResilienceContext) method.

Get(bool, CancellationToken)

Gets a ResilienceContext instance from the pool.

public ResilienceContext Get(bool continueOnCapturedContext, CancellationToken cancellationToken = default)

Parameters

continueOnCapturedContext bool

Value indicating whether to continue on captured context.

cancellationToken CancellationToken

The cancellation token.

Returns

ResilienceContext

An instance of ResilienceContext.

Remarks

After the execution is finished you should return the ResilienceContext back to the pool by calling Return(ResilienceContext) method.

Get(string?, bool?, CancellationToken)

Gets a ResilienceContext instance from the pool.

public ResilienceContext Get(string? operationKey, bool? continueOnCapturedContext, CancellationToken cancellationToken = default)

Parameters

operationKey string

An operation key associated with the context.

continueOnCapturedContext bool?

Value indicating whether to continue on captured context.

cancellationToken CancellationToken

The cancellation token.

Returns

ResilienceContext

An instance of ResilienceContext.

Remarks

After the execution is finished you should return the ResilienceContext back to the pool by calling Return(ResilienceContext) method.

Get(string?, CancellationToken)

Gets a ResilienceContext instance from the pool.

public ResilienceContext Get(string? operationKey, CancellationToken cancellationToken = default)

Parameters

operationKey string

An operation key associated with the context.

cancellationToken CancellationToken

The cancellation token.

Returns

ResilienceContext

An instance of ResilienceContext.

Remarks

After the execution is finished you should return the ResilienceContext back to the pool by calling Return(ResilienceContext) method.

Get(CancellationToken)

Gets a ResilienceContext instance from the pool.

public ResilienceContext Get(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

ResilienceContext

An instance of ResilienceContext.

Remarks

After the execution is finished you should return the ResilienceContext back to the pool by calling Return(ResilienceContext) method.

Return(ResilienceContext)

Returns a context back to the pool.

public abstract void Return(ResilienceContext context)

Parameters

context ResilienceContext

The context instance.

Exceptions

ArgumentNullException

Thrown when context is null.