Class ScheduleTask<TKey>
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
-
IScheduleTask<TKey>
- 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
TKeyUnderlying key.
maxEnqueuedInvocations
intSpecifies the maximum number of invocations that can be enqueued due to maximum concurrency. Equal to 0 by default.
maxConcurrentInvocations
intSpecifies 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
MaxEnqueuedInvocations
Specifies the maximum number of invocations that can be enqueued due to maximum concurrency.
public int MaxEnqueuedInvocations { get; }
Property Value
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
ReactiveTaskInvocationParamsInvocation parameters.
cancellationToken
CancellationTokenCancellationToken instance.
Returns
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
ReactiveTaskCompletionParamsCompletion 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
ReactiveTaskInvocationParamsInvocation parameters.
positionInQueue
intInvocation's position in queue.
Returns
- bool
true to proceed with enqueueing, false to cancel the invocation.