예제 #1
0
        /// <summary>
        /// 插入数据
        /// </summary>
        public void HandleData()
        {
            while (true)
            {
                PageRange pr;
                if (pageQueue.TryDequeue(out pr))
                {
                    _log.Info(string.Format("剩余页数:||||||||||{0}||||||||||", pageQueue.Count));
                    _log.Debug(string.Format("begin:{0}-end:{1}-开始获取数据...", pr.Begin, pr.End));
                    IList <T> dataList = GetList(pr.Begin, pr.End);

                    _log.Debug(string.Format("begin:{0}-end:{1}-获取到数据:{2}...", pr.Begin, pr.End, dataList == null?0: dataList.Count));
                    if (dataList != null && dataList.Count > 0)
                    {
                        Es.InsertData(dataList);
                    }
                    _log.Debug(string.Format("begin:{0}-end:{1}-索引完毕...", pr.Begin, pr.End));
                }
                else
                {
                    _log.Debug(string.Format("线程:{0}-索引完毕...", Thread.CurrentThread.ManagedThreadId));
                    Thread.CurrentThread.Abort();
                    break;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 处理
        /// </summary>
        public void HandleData()
        {
            _log.Debug(string.Format("开始获取数据..."));
            IList <T> dataList = GetAllList();

            _log.Debug(string.Format("获取到数据:{0}...开始索引", dataList == null ? 0 : dataList.Count));
            if (dataList != null && dataList.Count > 0)
            {
                Es.InsertData(dataList);
            }
            _log.Debug("索引完毕...");
        }