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); }
//////////////////////////////////////////////////////// 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); }
//////////////////////////////////////////////////////// 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; }