/// <summary>
        /// Initializes a new instance of the <see cref="TaskSchedulerMultiple"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="waitForFreeThread">The wait for free thread.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="jobCounter">The job counter.</param>
        /// <param name="multipleConfiguration">The multiple configuration.</param>
        public TaskSchedulerMultiple(ITaskSchedulerConfiguration configuration, IWaitForEventOrCancelThreadPool waitForFreeThread, IMetrics metrics,
                                     ITaskSchedulerJobCountSync jobCounter, TaskSchedulerMultipleConfiguration multipleConfiguration) : base(configuration, waitForFreeThread, metrics)
        {
            Guard.NotNull(() => jobCounter, jobCounter);
            Guard.NotNull(() => multipleConfiguration, multipleConfiguration);

            _jobCount             = jobCounter;
            MultipleConfiguration = multipleConfiguration;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SmartThreadPoolTaskScheduler"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="waitForFreeThread">The wait for free thread.</param>
        /// <param name="metrics">the metrics factory</param>
        public SmartThreadPoolTaskScheduler(ITaskSchedulerConfiguration configuration, 
            IWaitForEventOrCancelThreadPool waitForFreeThread,
            IMetrics metrics)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => waitForFreeThread, waitForFreeThread);
            Guard.NotNull(() => metrics, metrics);

            _configuration = configuration;
            _waitForFreeThread = waitForFreeThread;
            _metrics = metrics;
            _groups = new ConcurrentDictionary<IWorkGroup, WorkGroupWithItem>();
            _clients = new ConcurrentDictionary<int, int>();

            var name = GetType().Name;
            _taskCounter = metrics.Counter($"{name}.TaskCounter", Units.Items);
            _clientCounter = metrics.Counter($"{name}.ClientCounter", Units.Items);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SmartThreadPoolTaskScheduler"/> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="waitForFreeThread">The wait for free thread.</param>
        /// <param name="metrics">the metrics factory</param>
        public SmartThreadPoolTaskScheduler(ITaskSchedulerConfiguration configuration,
                                            IWaitForEventOrCancelThreadPool waitForFreeThread,
                                            IMetrics metrics)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => waitForFreeThread, waitForFreeThread);
            Guard.NotNull(() => metrics, metrics);

            _configuration     = configuration;
            _waitForFreeThread = waitForFreeThread;
            _metrics           = metrics;
            _groups            = new ConcurrentDictionary <IWorkGroup, WorkGroupWithItem>();
            _clients           = new ConcurrentDictionary <int, int>();

            var name = GetType().Name;

            _taskCounter   = metrics.Counter($"{name}.TaskCounter", Units.Items);
            _clientCounter = metrics.Counter($"{name}.ClientCounter", Units.Items);
        }