Class AsynchronousHandlerProcessor<TAsynchronousArgument>
Base class for processing carried out by AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument> and implementations of such.
Inheritance
Inherited Members
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public abstract class AsynchronousHandlerProcessor<TAsynchronousArgument> where TAsynchronousArgument : class
Type Parameters
Name | Description |
---|---|
TAsynchronousArgument | Type of object used as argument for processing asynchronous. |
Remarks
Thread handling and processing are separated into two parts. This part represents processing.
Implementations of this class needs to have a default constructor to work with AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
This class is instantiated by the AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
Constructors
AsynchronousHandlerProcessor()
Base class for processing carried out by AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument> and implementations of such.
Declaration
protected AsynchronousHandlerProcessor()
Remarks
Thread handling and processing are separated into two parts. This part represents processing.
Implementations of this class needs to have a default constructor to work with AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
This class is instantiated by the AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
Properties
Argument
Argument for the processor to work with.
Declaration
protected TAsynchronousArgument Argument { get; }
Property Value
Type | Description |
---|---|
TAsynchronousArgument |
Remarks
Thread handling and processing are separated into two parts. This part represents processing.
Implementations of this class needs to have a default constructor to work with AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
This class is instantiated by the AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
HasWorkToDo
Implemented by sub classes. Get if there are work to be carried out.
Declaration
public abstract bool HasWorkToDo { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Thread handling and processing are separated into two parts. This part represents processing.
Implementations of this class needs to have a default constructor to work with AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
This class is instantiated by the AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
Methods
ExecuteWorkAsync(CancellationToken)
Implemented by sub classes to execute the actual work.
Declaration
public virtual Task ExecuteWorkAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Remarks
Thread handling and processing are separated into two parts. This part represents processing.
Implementations of this class needs to have a default constructor to work with AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
This class is instantiated by the AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument>.
OnSetup(TAsynchronousArgument)
Called by AsynchronousHandler<TAsynchronousHandlerProcessor, TAsynchronousArgument> to initiate processing.
Declaration
public virtual bool OnSetup(TAsynchronousArgument argument)
Parameters
Type | Name | Description |
---|---|---|
TAsynchronousArgument | argument | Argument to use for processing. |
Returns
Type | Description |
---|---|
bool | True if able to sert up correctly. |
Remarks
The default implementation copies the argument to a member variable exposed by the Argument property