Click or drag to resize
ThreadWorkerT Class
Worker processing actions in single (one per application and generic variant), ever-running asynchronous thread
Inheritance Hierarchy

Namespace: CMS.Base
Assembly: CMS.Base (in CMS.Base.dll) Version: 8.2.23
Syntax
C#
public abstract class ThreadWorker<T>
where T : new(), ThreadWorker<T>

Type Parameters

T

The ThreadWorkerT type exposes the following members.

Constructors
Methods
  NameDescription
Protected methodCreateThread
Creates a worker thread object. Override to modify the thread configuration
Protected methodDoMaintenance
Runs the maintenance routine for the worker
Public methodStatic memberEnsureRunningThread
Ensures a running thread for this processor
Protected methodFinish
Finishes the worker process. Implement this method to specify what the worker must do in order to not lose its internal data when being finished. Leave empty if no extra action is required.
Protected methodInitialize
Initializes the worker. Runs in the worker thread before the thread processes the first iteration.
Public methodStatic memberIsThreadRunning
Returns true if the worker thread is currently running
Protected methodProcess
Method processing actions.
Public methodStatic memberRegister
Registers the worker so that it runs within the system
Protected methodRegisterInternal
Registers the worker
Public methodStatic memberReset
Resets the worker
Protected methodResetInternal
Resets the worker
Protected methodRun
Runs the action.
Protected methodRunAsync
Runs the task in an asynchronous thread.
Protected methodRunMaintenance
Runs the maintenance routine for the worker if it should run.
Protected methodRunProcess
Runs the internal process of the worker
Top
Extension Methods
  NameDescription
Public Extension MethodAsValue
Converts object to a query value which can be used as a query parameter
(Defined by QueryExtensions.)
Public Extension MethodGetAPIString
Gets the string by the specified resource key
(Defined by CoreExtensions.)
Public Extension MethodGetString
Gets the string by the specified resource key
(Defined by CoreExtensions.)
Public Extension MethodToBoolean
Returns the boolean representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToDateTime
Returns the DateTime representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToDouble
Returns the double representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToGuid
Returns the Guid representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToInteger
Returns the integer representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToString
Returns the string representation of an object or default value if not.
(Defined by CoreExtensions.)
Top
Fields
  NameDescription
Protected fieldStatic memberLOG_MAX_LENGTH
Maximum length of the worker log to prevent memory leaks (100kB by default)
Top
Properties
  NameDescription
Protected propertyStatic memberCurrent
Current thread worker object
Protected propertyDefaultInterval
Gets the default interval in milliseconds for the worker.
Protected propertyLastRun
Last run time
Protected propertyStatic memberLog
Asynchronous log context used by the worker thread
Protected propertyMaintenanceInterval
Gets the maintenance interval in milliseconds for the worker. When 0 (default), the maintenance is not performed.
Protected propertyNextMaintenance
Next maintenance time
Protected propertyPollThread
Gets or sets thread which is periodically checking for new tasks.
Protected propertyUseLogContext
If true, the thread uses a log context for its operations
Top
See Also