Exemplo n.º 1
0
        public override ResponseMessage Execute(RequestMessage request)
        {
            CountMatchQueryResponse result = new CountMatchQueryResponse();
            CountMatchQuery         query  = request as CountMatchQuery;

            if (query == null)
            {
                return(new ErrorResponse("Only CountMatch query please!"));
            }

            result.NumMatches = QueryDriver.DoCountMatchQuery(query);
            return(result);
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////

        static public int DoCountMatchQuery(CountMatchQuery query)
        {
            DehumanizeQuery(query);

            int num_matches = 0;

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

                foreach (Queryable q in Queryables)
                {
                    if (!q.AcceptQuery(query))
                    {
                        continue;
                    }

                    num_matches += q.DoCountMatchQuery(query);
                }
            } finally {
                iqueryable_lock.ReleaseReaderLock();
            }

            return(num_matches);
        }
Exemplo n.º 3
0
		////////////////////////////////////////////////////////

		static public int DoCountMatchQuery (CountMatchQuery query)
		{
			DehumanizeQuery (query);

			int num_matches = 0;

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

				foreach (Queryable q in Queryables) {
					if (! q.AcceptQuery (query))
						continue;

					num_matches += q.DoCountMatchQuery (query);
				}
			} finally {
				iqueryable_lock.ReleaseReaderLock ();
			}

			return num_matches;
		}