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
Methods
Get(ResilienceContextCreationArguments)
Gets a ResilienceContext instance from the pool.
public abstract ResilienceContext Get(ResilienceContextCreationArguments arguments)
Parameters
arguments
ResilienceContextCreationArgumentsThe 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
boolValue indicating whether to continue on captured context.
cancellationToken
CancellationTokenThe 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
stringAn operation key associated with the context.
continueOnCapturedContext
bool?Value indicating whether to continue on captured context.
cancellationToken
CancellationTokenThe 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
stringAn operation key associated with the context.
cancellationToken
CancellationTokenThe 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
CancellationTokenThe 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
ResilienceContextThe context instance.
Exceptions
- ArgumentNullException
Thrown when
context
is null.