Click or drag to resize

TaskManager Class

Polls for application tasks and broadcasts and delegates them to registered processors.
Inheritance Hierarchy

Namespace:  MFiles.VAF.AppTasks
Assembly:  MFiles.VAF (in MFiles.VAF.dll) Version: 2.3.623.2
Syntax
public class TaskManager : Stoppable

The TaskManager type exposes the following members.

Constructors
  NameDescription
Public methodTaskManager
Constructor.
Top
Properties
  NameDescription
Public propertyId
The id of the task manager (usually the namespace of the app it is running for).
Public propertyIsShuttingDown
Checks if the control is already shutting down.
(Inherited from Stoppable.)
Public propertyMaxConcurrency
The max number of tasks the manager can process at a given time across all queues. If this value is 0 (zero), then no tasks can be processed. If this value is -1, then there is no limit.
Protected propertyMaxLockWaitTime
Max lock wait time.
(Inherited from Stoppable.)
Public propertyProcessingInterval
The interval to sleep between process loop runs. If this is set to Zero, the process loop cannot be started using StartProcessing, instead Poll must be called every time the queues should be polled.
Public propertyServerId
The current server instance's id.
Public propertyServerName
The current server instance'sname.
Public propertyShutdownTask
Task that resolves when shutdown is fully completed.
(Inherited from Stoppable.)
Public propertyShutdownToken
Token that is canceled when the control begins to shutdown.
(Inherited from Stoppable.)
Public propertyVault
Permanent vault instance.
Top
Methods
  NameDescription
Public methodAddTask
Adds a task to a queue.
Protected methodAssertLockHeld
Throws if the current thread isn't holding any type of lock.
(Inherited from Stoppable.)
Protected methodAssertNotShuttingDown
Throws if the control is already shutting down.
(Inherited from Stoppable.)
Protected methodAssertWriteLockHeld
Throws if the current thread doesn't hold a write lock.
(Inherited from Stoppable.)
Protected methodBeginShutdownAsync
Called when shutdown was triggered.
(Overrides StoppableBeginShutdownAsync.)
Public methodCancelActiveTask
Attempts to send a cancel signal to an active task.
Public methodCancelWaitingTask
Marks a task as canceled. Throws if the task is not in the waiting state.
Public methodCancelWaitingTasks
Marks waiting tasks as canceled. Skips the task if it isn't in the waiting state.
Public methodDetachAllQueuesAsync
Detaches all queues from being processed by the manager.
Public methodDetachQueueAsync
Detaches a queue from being processed by the manager.
Public methodDispose
Dispose the object.
(Inherited from Stoppable.)
Protected methodDispose(Boolean)
Dispose implementation.
(Inherited from Stoppable.)
Protected methodEnterReadLock
Enter the lock in read mode.
(Inherited from Stoppable.)
Protected methodEnterWriteLock
Enter the lock in write mode.
(Inherited from Stoppable.)
Protected methodExitReadLock
Exit the currently held read lock.
(Inherited from Stoppable.)
Protected methodExitWriteLock
Exit the currently held write lock.
(Inherited from Stoppable.)
Public methodGetActiveTaskIds
Gets the ids of tasks currently being processed for this manager's queues, on this machine.
Public methodGetBroadcastProcessor
Gets the processor for a specific queue and broadcast type. Throws if not found.
Public methodGetDefaultBroadcastQueueId
Resolves the id of the default broadcast queue.
Public methodGetQueue
Gets a queue processor.
Public methodGetQueueIds
Gets the ids of all registered queues.
Public methodGetQueues
Gets all registered queue processors.
Public methodGetTaskProcessor
Gets the processor for a specific queue and task type. Throws if not found.
Public methodIsProcessing
Indicates whether the processing loop is running.
Public methodIsQueueRegistered
Checks if the task manager is currently processing a queue.
Public methodIsQueueShuttingDown
Checks if a queue is shutting down, or was already shutdown.
Public methodStatic memberIsSupported
Resolves whether the current environment supports the task queue.
Protected methodOnShutdownCompleted
Triggered after all shutdown operations have completed.
(Overrides StoppableOnShutdownCompleted.)
Public methodPoll
Triggers a single process cycle. Only allowed when the the task manager was created with ProcessingInterval having a value of Zero. This is primarily used for unit testing or externally driven processing intervals. This is NOT THREAD SAFE! Care should be taken so this is not called concurrently.
Public methodRegisterBroadcastProcessors
Registers the default broadcast queue with the provided processors. Opens the queue in the vault, if not done so already.
Public methodRegisterQueue
Registers a queue for the task manager to process. Opens the queue in the vault, if not done so already.
Public methodSendBroadcast(Vault, String, BroadcastDirective)
Sends a broadcast intended for the default broadcast queue.
Public methodSendBroadcast(Vault, String, String, BroadcastDirective)
Sends a broadcast.
Public methodShutdownAsync
Starts the shutdown process, if it hasn't already begun.
(Inherited from Stoppable.)
Public methodStartProcessing
Starts the processing loop in a background thread. Fails if ProcessingInterval is set to Zero. Fails if no queues are registered. The loop will automatically stop once all queues have been detatched.
Public methodTaskCancellationBroadcastHandler
Default, built-in handler for task cancellation broadcasts.
Top
Events
  NameDescription
Public eventBroadcastEvent
Emitted for the following event types: - BroadcastsProcessed - BroadcastParseError - BroadcastProcessingFailed
Public eventLifeCycleEvent
Emitted for the following event types: - ProcessingStarted - Stopping - Shutdown
Public eventPollEvent
Emitted for the following event types: - BroadcastsPolled - BroadcastPollFailed - TasksPolled - TaskPollFailed
Public eventProcessLoopEvent
Emitted for the following event types: - ProcessLoopStarting - ProcessLoopCanceled - ProcessLoopFailed - ProcessLoopCompleted
Public eventQueueEvent
Emitted for the following event types: - QueueRegistered - QueueStopping - QueueShutdown - QueueDetached
Public eventTaskEvent
Emitted for the following event types: - TaskJobStarted - TaskUpdated - TaskUpdateFailed - TaskJobRestarted - TaskJobFinished
Top
Fields
  NameDescription
Public fieldStatic memberDefaultBroadcastQueueSuffix
The ending of the default broadcast queue id.
Public fieldStatic memberTaskCancellationBroadcastType
The name of the built-in broadcast type that can be used to cancel tasks.
Top
See Also