C# Class CSharpAnalytics.Network.BackgroundHttpRequester

Responsible for requesting a queue of URIs over HTTP or HTTPS in background.
Inheritance: IDisposable
Afficher le fichier Open project: TechSmith/CSharpAnalytics Class Usage Examples

Protected Properties

Свойство Type Description
NetworkRetryWaitMax System.TimeSpan
NetworkRetryWaitStep System.TimeSpan

Private Properties

Свойство Type Description
Dispose void
GetNextQueueEntry bool
RequestLoop void
ShouldUsePostForRequest bool

Méthodes publiques

Méthode Description
Add ( Uri uri ) : void

Add a URI to be requested to the queue.

Dispose ( ) : void
Start ( System.TimeSpan uploadInterval, IEnumerable previouslyUnrequested = null ) : void

Start the BackgroundHttpRequester with a given upload interval and a list of previously unrequested URIs.

StopAsync ( ) : Task>

Stop the BackgroundHttpRequester and return a list of URIs that were not requested.

Méthodes protégées

Méthode Description
GetInnermostException ( Exception ex ) : Exception

Obtain the innermost Exception from within an Exception.

RequestWithFailureRetry ( Uri requestUri, CancellationToken cancellationToken ) : void

Request the URI retrying as appropriate if a failure occurs.

WaitBetweenFailedRequests ( System.TimeSpan &previousRetryDelay ) : void

Delay for a period of time between failed network requests.

Private Methods

Méthode Description
Dispose ( bool isDisposing ) : void
GetNextQueueEntry ( Uri &entry ) : bool

Get the next entry from the queue.

RequestLoop ( ) : void

Loop that keeps requesting URIs in the queue until there are none left, then sleeps.

ShouldUsePostForRequest ( Uri requestUri ) : bool

Whether a URI request is too long to be sent as a GET and instead the query parameters should be sent as the body of a POST instead.

Method Details

Add() public méthode

Add a URI to be requested to the queue.
public Add ( Uri uri ) : void
uri System.Uri URI to be requested.
Résultat void

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GetInnermostException() protected static méthode

Obtain the innermost Exception from within an Exception.
protected static GetInnermostException ( Exception ex ) : Exception
ex System.Exception Exception to obtain the innermost exception from.
Résultat System.Exception

RequestWithFailureRetry() protected abstract méthode

Request the URI retrying as appropriate if a failure occurs.
protected abstract RequestWithFailureRetry ( Uri requestUri, CancellationToken cancellationToken ) : void
requestUri System.Uri URI to requqest.
cancellationToken System.Threading.CancellationToken
Résultat void

Start() public méthode

Start the BackgroundHttpRequester with a given upload interval and a list of previously unrequested URIs.
public Start ( System.TimeSpan uploadInterval, IEnumerable previouslyUnrequested = null ) : void
uploadInterval System.TimeSpan How often to send the contents of the queue.
previouslyUnrequested IEnumerable List of previously unrequested URIs obtained last time the requester was stopped.
Résultat void

StopAsync() public méthode

Stop the BackgroundHttpRequester and return a list of URIs that were not requested.
public StopAsync ( ) : Task>
Résultat Task>

WaitBetweenFailedRequests() protected méthode

Delay for a period of time between failed network requests.
protected WaitBetweenFailedRequests ( System.TimeSpan &previousRetryDelay ) : void
previousRetryDelay System.TimeSpan Previous retry delay value to base delay on.
Résultat void

Property Details

NetworkRetryWaitMax protected_oe static_oe property

protected static TimeSpan,System NetworkRetryWaitMax
Résultat System.TimeSpan

NetworkRetryWaitStep protected_oe static_oe property

protected static TimeSpan,System NetworkRetryWaitStep
Résultat System.TimeSpan