/// <summary> /// Creates a bulk-item <see cref="ProcessDictionary{TKey, TValue}"/> based on the generic <see cref="DictionaryList{TKey, TValue}"/> class. /// </summary> /// <param name="processItemsFunction">A delegate <see cref="ProcessItemFunctionSignature"/> that defines a function signature to process multiple items at once.</param> /// <param name="canProcessItemFunction">A delegate <see cref="CanProcessItemFunctionSignature"/> that determines if a key and value can currently be processed.</param> /// <param name="processInterval">A <see cref="double"/> which represents the process interval.</param> /// <param name="maximumThreads">An <see cref="int"/> that represents the max number of threads to use.</param> /// <param name="processTimeout">An <see cref="int"/> that represents the amount of time before a process times out.</param> /// <param name="requeueOnTimeout">A <see cref="bool"/> value that indicates whether the process should requeue the item after a timeout.</param> /// <param name="requeueOnException">A <see cref="bool"/> value that indicates whether the process should requeue the item after an exception.</param> public ProcessDictionary(ProcessItemsFunctionSignature processItemsFunction, CanProcessItemFunctionSignature canProcessItemFunction = null, double processInterval = DefaultProcessInterval, int maximumThreads = DefaultMaximumThreads, int processTimeout = DefaultProcessTimeout, bool requeueOnTimeout = DefaultRequeueOnTimeout, bool requeueOnException = DefaultRequeueOnException) : base(null, processItemsFunction, null, new DictionaryList <TKey, TValue>(), processInterval, maximumThreads, processTimeout, requeueOnTimeout, requeueOnException) { m_canProcessItemFunction = canProcessItemFunction; // Assigns translator functions for base class. if ((object)m_canProcessItemFunction != null) { base.CanProcessItemFunction = CanProcessKeyedItem; } }
/// <summary> /// Releases the unmanaged resources used by the <see cref="ProcessDictionary{TKey, TValue}"/> object and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected override void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) { m_processItemFunction = null; m_canProcessItemFunction = null; } } finally { m_disposed = true; // Prevent duplicate dispose. base.Dispose(disposing); // Call base class Dispose(). } } }