コード例 #1
0
        public void ClearAllLocks_NoFoldersExist_ExitsCleanly()
        {
            // setup
            _reportLocationProvider.GetProcessingRootFolder().Returns(_testRootFolder);

            // execute
            _concurrencyCoordinator.ClearAllLocks();
        }
コード例 #2
0
        private void WorkerThreadFunc()
        {
            int pollInterval = _appSettings.PollInterval;

            // on start up, make sure we clear out any old locks if they exist - this is
            // just in case there were issues, or the server rebooted.  We may end up with
            // Report queue items in an odd state but that will need to be handled manually
            _concurrencyCoordinator.ClearAllLocks();

            while (!_shutdownEvent.WaitOne(0))
            {
                int executedCount = 0;
                try
                {
                    IEnumerable <ReportJob> jobs = _reportEngine.ExecuteReports();
                    executedCount = jobs.Count();
                    _logger.Info("{0} jobs started", executedCount);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex, ex.Message);
                }

                // sleep for poll interval
                Thread.Sleep(pollInterval);
            }
        }