Beispiel #1
0
        public void SpinBackgroundWorkers()
        {
            if (backgroundWorkersSpun)
            {
                throw new InvalidOperationException("The background workers has already been spun and cannot be spun again");
            }
            var disableIndexing = Configuration.Settings[Constants.IndexingDisabled];

            if (null != disableIndexing)
            {
                bool disableIndexingStatus;
                var  res = bool.TryParse(disableIndexing, out disableIndexingStatus);
                if (res && disableIndexingStatus)
                {
                    return;                               //indexing were set to disable
                }
            }
            backgroundWorkersSpun = true;

            workContext.StartWork();
            indexingBackgroundTask = Task.Factory.StartNew(indexingExecuter.Execute, CancellationToken.None, TaskCreationOptions.LongRunning, backgroundTaskScheduler);

            ReducingExecuter = new ReducingExecuter(workContext);

            reducingBackgroundTask = Task.Factory.StartNew(ReducingExecuter.Execute, CancellationToken.None, TaskCreationOptions.LongRunning, backgroundTaskScheduler);
        }
Beispiel #2
0
        public void SpinIndexingWorkers()
        {
            if (backgroundWorkersSpun)
            {
                throw new InvalidOperationException("The background workers has already been spun and cannot be spun again");
            }

            backgroundWorkersSpun = true;

            workContext.StartIndexing();
            indexingBackgroundTask = Task.Factory.StartNew(indexingExecuter.Execute, CancellationToken.None, TaskCreationOptions.LongRunning, backgroundTaskScheduler);

            ReducingExecuter = new ReducingExecuter(workContext);

            reducingBackgroundTask = Task.Factory.StartNew(ReducingExecuter.Execute, CancellationToken.None, TaskCreationOptions.LongRunning, backgroundTaskScheduler);
        }