示例#1
0
        public LimitedConcurrencyController(JobProcessBehavior processItemBehavior, int threadNumber, Options options)
            : base(processItemBehavior, threadNumber, options)
        {
            _localTaskFactory = new TaskFactory(new LimitedConcurrencyLevelTaskScheduler(threadNumber));
            _executedTasks    = new List <Task>();

            _taskCounter = 0;

            _stopCancellationTokenSource = new CancellationTokenSource();
            _pauseSignalOn = false;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of Controller
        /// </summary>
        /// <param name="threadNumber">number of threads to process jobs simultaneously</param>
        /// <param name="options">options for initialization, e.g. database requisites etc.</param>
        public Controller(JobProcessBehavior processItemBehavior, int threadNumber, Options options)
        {
            _threadNumber = threadNumber;
            _options      = options;

            _controllerStateManager = new ControllerStateManager();

            _processItemBehavior = processItemBehavior;
            _queue = new ConcurrentQueue <IJobInfo>();

            _processItemBehavior.AddToQueue += _processItemBehavior_AddToQueue;
            mProcessInfo = new ProcessInfo();
        }