Exemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name">Name of queue</param>
        /// <param name="maxThreadsCount">limit of threads count; Default: -1 - no limit</param>
        public DistributedTaskQueue(DistributedTaskCacheNotify distributedTaskCacheNotify, string name, int maxThreadsCount = -1)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            key       = name + GetType().Name;
            scheduler = maxThreadsCount <= 0
                ? TaskScheduler.Default
                : new LimitedConcurrencyLevelTaskScheduler(maxThreadsCount);
            DistributedTaskCacheNotify = distributedTaskCacheNotify;
            cancelations = DistributedTaskCacheNotify.Cancelations;
            cache        = DistributedTaskCacheNotify.Cache;
        }
Exemplo n.º 2
0
 public ConfigureDistributedTaskQueue(DistributedTaskCacheNotify distributedTaskCacheNotify, IServiceProvider serviceProvider)
 {
     DistributedTaskCacheNotify = distributedTaskCacheNotify;
     ServiceProvider            = serviceProvider;
 }