Edytuj

Udostępnij za pośrednictwem


AsyncPipeline Class

Definition

A helper utility class that allows to control the rate of generation of asynchronous activities. Maintains a pipeline of asynchronous operations up to a given maximal capacity and blocks the calling thread if the pipeline gets too deep before enqueued operations are not finished. Effectively adds a back-pressure to the caller. This is mainly usefull for stress-testing grains under controlled load and should never be used from within a grain code!

public class AsyncPipeline : Orleans.Runtime.IPipeline
type AsyncPipeline = class
    interface IPipeline
Public Class AsyncPipeline
Implements IPipeline
Inheritance
AsyncPipeline
Implements

Constructors

AsyncPipeline()

Constructs an empty AsyncPipeline with capacity equal to the DefaultCapacity.

AsyncPipeline(Int32)

Constructs an empty AsyncPipeline with a given capacity.

Fields

DEFAULT_CAPACITY

The Default Capacity of this AsyncPipeline. Equals to 10.

Properties

Capacity

The maximal number of async in-flight operations that can be enqueued into this async pipeline.

Count

The number of items currently enqueued into this async pipeline.

Methods

Add(Task)

Adds a new task to this AsyncPipeline.

AddRange(IEnumerable<Task>)

Adds a collection of tasks to this AsyncPipeline.

AddRange<T>(IEnumerable<Task<T>>)

Adds a collection of tasks to this AsyncPipeline.

Wait()

Waits until all currently queued asynchronous operations are done. Blocks the calling thread.

Applies to