Allows work items to be queued and sent to a worker for processing.
A work dispatcher is created by the work manager service.
Inheritance Hierarchy
Spotfire.Dxp.Framework.ThreadingWorkDispatcher
Spotfire.Dxp.Framework.ThreadingWorkDispatcherTItem
Namespace: Spotfire.Dxp.Framework.Threading
Assembly: Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 30.0.10915.3380 (30.0.10915.3380)
Syntax
C#
public sealed class WorkDispatcher<TItem> : WorkDispatcher where TItem : WorkItem
Type Parameters
- TItem
- WorkItem type.
The WorkDispatcherTItem type exposes the following members.
Methods
Name | Description | |
---|---|---|
AddFirst | Adds the item to the front of the queue.
| |
AddLast | Adds the item to the back of the queue.
| |
AddWorkerModelChangedHandler | Adds a handler for the worker model changed event.
If AutoCancel is true, all currently
dispatched work items are canceled before this event is raised.
The callee would typically invalidate any stored work results,
and dispatch new work items when needed.
The event can be raised on any thread.
| |
Cancel(IEnumerableTItem) | Cancel the specified work items.
| |
Cancel(TItem) | Cancel the work item.
| |
CancelAll | Cancel all work items.
(Inherited from WorkDispatcher.) | |
Dispose | Cancels all work items and frees up resources.
(Inherited from WorkDispatcher.) | |
ExecuteSynchronously | Executes the item synchronously.
This method is suitable when forced to execute
items one by one and access the result synchronously.
| |
GetItems | Gets the work items that are currently waiting to be dispatched.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
RemoveWorkerModelChangedHandler | Removes a handler for the worker model changed event.
| |
SetItems | Sets the items to be dispatched. The first item will be dispatched first.
| |
WaitAll | Waits until all items have been processed.
|
Properties
Name | Description | |
---|---|---|
AutoCancel | Gets or sets a value indicating whether worker model changes should
automatically cancel added work items.
The default value is true.
(Inherited from WorkDispatcher.) | |
AutoDisposeItems | Gets or sets a value indicating whether work items should be automatically disposed.
The default value is true. Manipulating this flag should be avoided whenever possible.
Instead use work item handlers to make sure that work items are not disposed too early.
(Inherited from WorkDispatcher.) | |
IsDisposed | Gets a value indicating whether this instance has been disposed.
(Inherited from WorkDispatcher.) | |
MaxQueueSize | Gets or sets the maximum allowed number of items waiting to be dispatched.
Before new items are added, items at the back of the queue will be canceled to make room.
(Inherited from WorkDispatcher.) |
Remarks
Version Information
See Also