/// <summary> /// This method is called by the web service when a job gets sent by one of the clients. /// </summary> /// <param name="recordID"></param> internal void RunJob(string recordID) { // We spawn a temporary thread so the service can return to the client quickly. If this isn't done, the service throws exceptions from here as well as its own. ThreadPool.QueueUserWorkItem(new WaitCallback(delegate { DataTable dtPendingCase = bi.GetPendingCase(recordID); foreach (DataRow dr in dtPendingCase.Rows) { // check to see whether the case we have is a long-running job or a normal job and queue appropriately switch (dr["CompareMethod"].ToString()) { case "13": case "14": case "17": lock (jobQueueLock) if (dr["Compare_Type"].ToString() == "N") { jobQueue.Enqueue(dr); } else { longJobQueue.Enqueue(dr); } break; default: lock (jobQueueLock) jobQueue.Enqueue(dr); break; } // set the case status to processing bi.UpdateCaseStatus(dr["RecordID"].ToString(), "P"); } return; })); }