ExecutionAttemptArguments
Arguments that encapsulate the execution attempt for retries or hedging.
using Polly.Utils;
using System;
using System.Runtime.CompilerServices;
namespace Polly.Telemetry
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class ExecutionAttemptArguments
{
private static readonly ObjectPool<ExecutionAttemptArguments> Pool = new ObjectPool<ExecutionAttemptArguments>(() => new ExecutionAttemptArguments(), delegate(ExecutionAttemptArguments args) {
args.ExecutionTime = TimeSpan.Zero;
args.Attempt = 0;
args.Handled = false;
});
public int Attempt { get; set; }
public TimeSpan ExecutionTime { get; set; }
public bool Handled { get; set; }
public ExecutionAttemptArguments(int attempt, TimeSpan executionTime, bool handled)
{
Attempt = attempt;
ExecutionTime = executionTime;
Handled = handled;
}
private ExecutionAttemptArguments()
{
}
internal static ExecutionAttemptArguments Get(int attempt, TimeSpan executionTime, bool handled)
{
ExecutionAttemptArguments executionAttemptArguments = Pool.Get();
executionAttemptArguments.Attempt = attempt;
executionAttemptArguments.ExecutionTime = executionTime;
executionAttemptArguments.Handled = handled;
return executionAttemptArguments;
}
internal static void Return(ExecutionAttemptArguments args)
{
Pool.Return(args);
}
}
}