Table of Contents

Class ScheduleTask<TKey>

Namespace
LfrlAnvil.Reactive.Chrono
Assembly
LfrlAnvil.Reactive.Chrono.dll

Represents a reactive task that can be registered in ReactiveScheduler<TKey>.

public abstract class ScheduleTask<TKey> : IScheduleTask<TKey>, IDisposable where TKey : notnull

Type Parameters

TKey

Task key type.

Inheritance
ScheduleTask<TKey>
Implements
Inherited Members

Constructors

ScheduleTask(TKey, int, int)

Creates a new ScheduleTask<TKey> instance.

protected ScheduleTask(TKey key, int maxEnqueuedInvocations = 0, int maxConcurrentInvocations = 1)

Parameters

key TKey

Underlying key.

maxEnqueuedInvocations int

Specifies the maximum number of invocations that can be enqueued due to maximum concurrency. Equal to 0 by default.

maxConcurrentInvocations int

Specifies the maximum number of concurrently running invocations. Equal to 1 by default.

Properties

Key

Underlying key.

public TKey Key { get; }

Property Value

TKey

MaxConcurrentInvocations

Specifies the maximum number of concurrently running invocations.

public int MaxConcurrentInvocations { get; }

Property Value

int

MaxEnqueuedInvocations

Specifies the maximum number of invocations that can be enqueued due to maximum concurrency.

public int MaxEnqueuedInvocations { get; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual void Dispose()

InvokeAsync(IReactiveScheduler<TKey>, ReactiveTaskInvocationParams, CancellationToken)

Invokes the task.

public abstract Task InvokeAsync(IReactiveScheduler<TKey> scheduler, ReactiveTaskInvocationParams parameters, CancellationToken cancellationToken)

Parameters

scheduler IReactiveScheduler<TKey>

Source scheduler.

parameters ReactiveTaskInvocationParams

Invocation parameters.

cancellationToken CancellationToken

CancellationToken instance.

Returns

Task

OnCompleted(IReactiveScheduler<TKey>, ReactiveTaskCompletionParams)

Callback for task invocation completion.

public virtual void OnCompleted(IReactiveScheduler<TKey> scheduler, ReactiveTaskCompletionParams parameters)

Parameters

scheduler IReactiveScheduler<TKey>

Source scheduler.

parameters ReactiveTaskCompletionParams

Completion parameters.

OnEnqueue(IReactiveScheduler<TKey>, ReactiveTaskInvocationParams, int)

Callback invoked before the task invocation gets enqueued due to maximum concurrency.

public virtual bool OnEnqueue(IReactiveScheduler<TKey> scheduler, ReactiveTaskInvocationParams parameters, int positionInQueue)

Parameters

scheduler IReactiveScheduler<TKey>

Source scheduler.

parameters ReactiveTaskInvocationParams

Invocation parameters.

positionInQueue int

Invocation's position in queue.

Returns

bool

true to proceed with enqueueing, false to cancel the invocation.