示例#1
0
        /// <summary>
        /// 添加数据更新索引任务
        /// </summary>
        /// <param name="job"></param>
        public void AddBaseEntity(BaseEntity2 item)
        {
            if (threadBaseEntity == null)
            {
                StartThreadBaseEntity();
            }

            listBaseEntity.Enqueue(item);
        }
示例#2
0
        /// <summary>
        /// 索引任务线程
        /// </summary>
        private void UpBaseEntity()
        {
            //logger.Debug("索引任务线程启动");
            while (true)
            {
                if (listBaseEntity.Count <= 0)
                {
                    Thread.Sleep(5 * 1000);
                    continue;
                }
                while (listBaseEntity.Count != 0)
                {
                    BaseEntity2 item = listBaseEntity.Dequeue();
                    switch (item.JobType)
                    {
                    case JobType.New:
                        //if (item.SourceName == "LI_SearchHistory")
                        //{
                        //    Zsk_SearchHistory search = (Zsk_SearchHistory)item.BaseEntity;
                        //    search.ClientName = Dns.GetHostEntry(search.ClientIP).HostName;
                        //}
                        //else if (item.SourceName == "LI_DwonFileLog")
                        //{
                        //    Zsk_DwonFileLog search = (Zsk_DwonFileLog)item.BaseEntity;
                        //    search.ClientName = Dns.GetHostEntry(search.ClientIP).HostName;
                        //}
                        //item.BaseEntity.Insert();
                        break;

                    case JobType.Remove:
                        //item.BaseEntity.Delete();
                        break;

                    case JobType.Up:
                        //item.BaseEntity.Update();
                        break;
                    }
                }
                //logger.Debug("全部索引完毕");
            }
        }