private void PerformRequests()
        {
            Logger.Info("Worker thread for processing request queue has started.", "BackgroundDataService");

            while (true)
            {
                try
                {
                    if ((DateTime.Now - LastQueuePerformed).TotalSeconds > 10)
                    {
                        Logger.Info("Performing requests OLEYYYY...", "BackgroundDataService");
                        LastQueuePerformed = DateTime.Now;
                    }

                    QueryMediator.PerformRequests();
                    QueryMediator.TimeOutRequests();
                    Thread.Sleep(30000);
                }
                catch (ThreadAbortException)
                {
                    Logger.Info("Worker thread for processing request queue is terminated.", "BackgroundDataService");
                    break;
                }
                catch (Exception exc)
                {
                    Logger.Info("An error occured while performing requests:. " + exc.Message, "BackgroundDataService");
                    Logger.Error(exc, "BackgroundDataService");
                }
            }
        }
 private void EnqueueRequests(object sender, ElapsedEventArgs e)
 {
     try
     {
         QueryMediator.EnqueueRequests(e.SignalTime);
     }
     catch (Exception exc)
     {
         Logger.Error(exc, "BackgroundDataService");
     }
 }
        public void OnStop()
        {
            Logger.Info("Stopping service ...", "BackgroundDataService");
            timer.Enabled = false;
            Logger.Info("Timer disabled, waiting for pending requests to complete ...", "BackgroundDataService");

            int outstanding = QueryMediator.GetQueuedRequests().Length;

            Logger.Info(String.Format("No of enqued requests is {0}, waiting to terminate ...", outstanding), "BackgroundDataService");

            QueryMediator.CancelRequests();
            worker.Abort();

            Logger.Info("Service successfully terminated.", "BackgroundDataService");
        }