Show / Hide Table of Contents

Class ParallelizedProcessor

Base class for processing that can be run in parallel and controlled by the IParallelizedProcessorControlPlane. This is typically an instance of ParallelProcessor<TParallelizedProcessor>.

Inheritance
object
ParallelizedProcessor
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public abstract class ParallelizedProcessor
Remarks

Class implementing this abstract classes are responsible for processing parts in parallel, by implementint the abstract method ProcessPartAsync(CancellationToken)

Constructors

ParallelizedProcessor()

Base class for processing that can be run in parallel and controlled by the IParallelizedProcessorControlPlane. This is typically an instance of ParallelProcessor<TParallelizedProcessor>.

Declaration
protected ParallelizedProcessor()
Remarks

Class implementing this abstract classes are responsible for processing parts in parallel, by implementint the abstract method ProcessPartAsync(CancellationToken)

Fields

_controlPlane

Controle plane for the processor.

Declaration
protected IParallelizedProcessorControlPlane _controlPlane
Field Value
Type Description
IParallelizedProcessorControlPlane
Remarks

Class implementing this abstract classes are responsible for processing parts in parallel, by implementint the abstract method ProcessPartAsync(CancellationToken)

Properties

Id

Process-wide uniqe identifier. of the processor. Counter starts at 0, and is incremented for each new instance.

Declaration
public int Id { get; }
Property Value
Type Description
int
Remarks

Class implementing this abstract classes are responsible for processing parts in parallel, by implementint the abstract method ProcessPartAsync(CancellationToken)

Methods

Cleanup()

Virtual method that can be overridden by the derived class to perform cleanup when processing is done.

Declaration
protected virtual void Cleanup()
Remarks

Class implementing this abstract classes are responsible for processing parts in parallel, by implementint the abstract method ProcessPartAsync(CancellationToken)

ExecuteAsync(IParallelizedProcessorControlPlane, CancellationToken)

Called by the ParallelProcessor<TParallelizedProcessor> to start processing.

Declaration
public Task ExecuteAsync(IParallelizedProcessorControlPlane controlPlane, CancellationToken cancellationToken)
Parameters
Type Name Description
IParallelizedProcessorControlPlane controlPlane

Control plane backing the processing.

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

Processing should continue as long as cancellation is not requested or ShouldProcessorContinue(ParallelizedProcessor) returns false. Any exception occuring while processing, shoudl be reported to the control plane using ReportError(ParallelizedProcessor, Exception). When processing has ended, for any reason, the control plane should be notified by calling ReportCompleted(ParallelizedProcessor). This will alse ensure that New tasks are started up as needed.

ProcessPartAsync(CancellationToken)

Abstract method that must be implemented by the derived class to process a part of the work.

Declaration
public abstract Task ProcessPartAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

Work should be safely terminated on cancellation. This is typically set when service is instructed to stop.

Returns
Type Description
Task
Remarks

Class implementing this abstract classes are responsible for processing parts in parallel, by implementint the abstract method ProcessPartAsync(CancellationToken)

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top