Пример #1
0
        static private void QueryEachQueryable(Query query, QueryResult result)
        {
            // The extra pair of calls to WorkerStart/WorkerFinished ensures:
            // (1) that the QueryResult will fire the StartedEvent
            // and FinishedEvent, even if no queryable accepts the
            // query.
            // (2) that the FinishedEvent will only get called when all of the
            // backends have had time to finish.

            object dummy_worker = new object();

            if (!result.WorkerStart(dummy_worker))
            {
                return;
            }

            try {
                iqueryable_lock.AcquireReaderLock(System.Threading.Timeout.Infinite);

                foreach (Queryable queryable in Queryables)
                {
                    DoOneQuery(queryable, query, result, null);
                }
            } finally {
                iqueryable_lock.ReleaseReaderLock();
            }

            result.WorkerFinished(dummy_worker);
        }
Пример #2
0
 public void Start()
 {
     try {
         worker.DoWork();
     } catch (Exception e) {
         Logger.Log.Error(e, "QueryWorker '{0}' threw an exception", worker);
     }
     try {
         result.WorkerFinished(worker);
     } catch (Exception e) {
         Logger.Log.Error("QueryResult threw an exception while calling WorkerFinished for '{0}'",
                          worker);
     }
 }
Пример #3
0
		static private void QueryEachQueryable (Query query, QueryResult result)
		{
			// The extra pair of calls to WorkerStart/WorkerFinished ensures:
			// (1) that the QueryResult will fire the StartedEvent
			// and FinishedEvent, even if no queryable accepts the
			// query.
			// (2) that the FinishedEvent will only get called when all of the
			// backends have had time to finish.

			object dummy_worker = new object ();

			if (! result.WorkerStart (dummy_worker))
				return;

			try {
				iqueryable_lock.AcquireReaderLock (System.Threading.Timeout.Infinite);

				foreach (Queryable queryable in Queryables)
					DoOneQuery (queryable, query, result, null);
			} finally {
				iqueryable_lock.ReleaseReaderLock ();
			}
			
			result.WorkerFinished (dummy_worker);
		}