public void TrackJob(HtmlRecord record) { lock (jobSet) { jobSet.Add(record.recordid, record); } }
public void Enqueue(HtmlRecord page) { lock (workQueue) { workQueue.Enqueue(page); } }
public void EnqueueResult(HtmlRecord record) { lock (messageQueue) { Message message = new RecordMessage(record); messageQueue.Enqueue(PriorityLevel.Normal, message); allowSend.Set(); } }
public void EnqueueWork(HtmlRecord record) { lock (domainDictionary) { string key = record.domain.Host; if (domainDictionary.ContainsKey(key)) { domainDictionary[key].Enqueue(record); } else { domainDictionary[key] = new Domain(key); domainDictionary[key].Enqueue(record); domainDictionary[key].InitTimer(); } //PrintDomains(); } }
public void Update(object stateInfo) { if (workQueue.Count != 0) { HtmlRecord record = Dequeue(); if (record.waitTime != 0) { ThreadPool.QueueUserWorkItem(new WaitCallback(record.SleepThenUpdate)); } else { record.BeginUpdate(); } } else { timer.Dispose(); WebCrawler.Instance.RemoveDomain(this.domainName); } }
public RecordMessage(HtmlRecord record) { htmlRecord = record; }