public IList <ExtractorConfiguration> getConfigs() { _report.addDebug("The orchestrator is attempting to obtain it's configuration data"); if (_configurations != null && DateTime.Now.Subtract(_lastFetchedDbConfigs).TotalMinutes < 5) // don't let this happen too often - this smells but need to refactor out some of the spaghetti... { _report.addDebug("Tried fetching configs from database twice in < 5 minutes - using saved configs"); return(_configurations); } try { _configurations = pruneConfigByCRON(_sqlDao.getActiveExtractorConfigurations()); _lastFetchedDbConfigs = DateTime.Now; // compute the next run time based off config and sleep configuration param if (_configurations != null && _configurations.Count > 0) { try { _serviceState.NextRun = CrontabSchedule.Parse(_configurations[0].CRON).GetNextOccurrence(DateTime.Now.AddMinutes(_cronSchedule)); } catch (Exception exc) { _report.addError("Problem computing next run time: " + exc.Message); } } // get the set of orchestrator host names so we can provide this information to the extractors for failover IList <string> orchestrators = _sqlDao.getOrchestrators(); // only add an orchestrator host name if it is not the current host name foreach (ExtractorConfiguration config in _configurations) { config.AllOrchestrators = new List <string>(); foreach (string s in orchestrators) { if (!String.Equals(s, _myHostName, StringComparison.CurrentCultureIgnoreCase)) { config.AllOrchestrators.Add(s); } } } adjustConfigs(_configurations); _activeJobsAtStartUp = _sqlDao.getLockedFiles(); if (_activeJobsAtStartUp == null) // can be empty but not null - something probably went wrong { throw new ApplicationException("The list of active jobs appears to be malformed"); } Log.LOG("The SQL database reported " + _activeJobsAtStartUp.Count + " active jobs at iteration"); _report.addInfo("The SQL database reported " + _activeJobsAtStartUp.Count + " active jobs at iteration"); _report.addDebug("The SQL database reported " + _activeJobsAtStartUp.Count + " active jobs to the orchestrator on iteration"); } catch (Exception exc) { Log.LOG("Unable to start orchestrator because no configurations were found: " + exc.ToString()); _report.addError("Unable to start orchestrator because no configurations were found", exc); _report.HasError = "T"; throw exc; } _report.addDebug("The orchestrator service found " + _configurations.Count + " extraction configurations"); return(_configurations); }