Class BackOffHandler.Initializer (1.55.0)

public class Initializer

An initializer class to initialize a back-off handler.

Inheritance

Object > BackOffHandler.Initializer

Namespace

Google.Apis.Http

Assembly

Google.Apis.Core.dll

Constructors

Initializer(IBackOff)

public Initializer(IBackOff backOff)

Constructs a new initializer by the given back-off.

Parameter
NameDescription
backOffIBackOff

Fields

DefaultHandleExceptionFunc

public static readonly Func<Exception, bool> DefaultHandleExceptionFunc

Default function which handles exception which aren't TaskCanceledException or OperationCanceledException. Those exceptions represent a task or an operation which was canceled and shouldn't be retried.

Field Value
TypeDescription
Func<Exception, Boolean>

DefaultHandleUnsuccessfulResponseFunc

public static readonly Func<HttpResponseMessage, bool> DefaultHandleUnsuccessfulResponseFunc

Default function which handles server errors (503).

Field Value
TypeDescription
Func<HttpResponseMessage, Boolean>

Properties

BackOff

public IBackOff BackOff { get; }

Gets the back-off policy used by this back-off handler.

Property Value
TypeDescription
IBackOff

HandleExceptionFunc

public Func<Exception, bool> HandleExceptionFunc { get; set; }

Gets or sets a delegate function which indicates whether this back-off handler should handle an exception. The default is DefaultHandleExceptionFunc.

Property Value
TypeDescription
Func<Exception, Boolean>

HandleUnsuccessfulResponseFunc

public Func<HttpResponseMessage, bool> HandleUnsuccessfulResponseFunc { get; set; }

Gets or sets a delegate function which indicates whether this back-off handler should handle an abnormal HTTP response. The default is DefaultHandleUnsuccessfulResponseFunc.

Property Value
TypeDescription
Func<HttpResponseMessage, Boolean>

MaxTimeSpan

public TimeSpan MaxTimeSpan { get; set; }

Gets or sets the maximum time span to wait. If the back-off instance returns a greater time span than this value, this handler returns false to both HandleExceptionAsync and HandleResponseAsync. Default value is 16 seconds per a retry request.

Property Value
TypeDescription
TimeSpan

Extension Method