/// <summary>
        /// Disposes of the object.
        /// </summary>
        /// <param name="cacheMonitor">The cache monitor instance to dispose.</param>
        public static void DisposeIfNecessary(this IWorkerCacheMonitor cacheMonitor)
        {
            if (cacheMonitor == null)
            {
                throw new ArgumentNullException(nameof(cacheMonitor));
            }

            (cacheMonitor as IDisposable)?.Dispose();
        }
Exemple #2
0
 public TestableWorkerPool(IWorkerCache cache, IWorkerCacheMonitor cacheMonitor)
     : base(cache, cacheMonitor)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WorkerPool"/> class.
 /// </summary>
 /// <param name="cache">The cache of workers available for the pool.</param>
 /// <param name="cacheMonitor">The monitor which will track the cache.</param>
 internal WorkerPool(IWorkerCache cache, IWorkerCacheMonitor cacheMonitor)
 {
     this.cache        = cache ?? throw new ArgumentNullException(nameof(cache));
     this.cacheMonitor = cacheMonitor ?? throw new ArgumentNullException(nameof(cacheMonitor));
 }