Exemple #1
0
 public void TrackJob(HtmlRecord record)
 {
     lock (jobSet)
     {
         jobSet.Add(record.recordid, record);
     }
 }
Exemple #2
0
 public void Enqueue(HtmlRecord page)
 {
     lock (workQueue)
     {
         workQueue.Enqueue(page);
     }
 }
Exemple #3
0
 public void EnqueueResult(HtmlRecord record)
 {
     lock (messageQueue)
     {
         Message message = new RecordMessage(record);
         messageQueue.Enqueue(PriorityLevel.Normal, message);
         allowSend.Set();
     }
 }
Exemple #4
0
 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();
     }
 }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
 public RecordMessage(HtmlRecord record)
 {
     htmlRecord = record;
 }