示例#1
0
        private void GetData(out List <PawnDocRegVO> totList, out bool docGetError, out bool completed)
        {
            totList     = new List <PawnDocRegVO>();
            docGetError = false;
            completed   = false;

            while (true)
            {
                if (!daoThread.IsDataReady)
                {
                    log.Info("Data not ready sleeping");
                    Thread.Sleep(5000);

                    if (worker.CancellationPending)
                    {
                        log.Info("cancel pressed felt in GetData: main workder :step1");
                        WaitUntillAllJobsCompleted();
                        return;
                    }
                }
                else
                {
                    log.Info("Data Ready.. Transferring");
                    if (daoThread.HasReachedEnd() || daoThread.HasErrorOccured())
                    {
                        docGetError = daoThread.HasErrorOccured();
                        completed   = daoThread.HasReachedEnd();
                        return;
                    }
                    if (daoThread.getData() == null)
                    {
                        log.Info("DAO Thread returned null, stopping run");
                        return;
                    }
                    totList.AddRange(daoThread.getData());
                    daoThread.setData(null);
                    //set daoThread is read so that next search can begin
                    daoThread.IsDataConsumed = true;
                    if (totList.Count > 0)
                    {
                        lastRecord = totList[totList.Count - 1].DocID;
                    }
                    else
                    {
                        completed = true;
                    }
                    return;
                }
            }
        }
示例#2
0
        private void GetData(out List <PawnDocRegVO> totList, out bool docGetError, out bool completed)
        {
            totList     = new List <PawnDocRegVO>();
            docGetError = false;
            completed   = false;

            while (true)
            {
                if (!daoThread.IsDataReady)
                {
                    log.Info("Data not ready sleepding");
                    Thread.Sleep(5000);
                }
                else
                {
                    log.Info("Data Ready.. Transferring");
                    if (daoThread.HasReachedEnd() || daoThread.HasErrorOccured())
                    {
                        docGetError = daoThread.HasErrorOccured();
                        completed   = daoThread.HasReachedEnd();
                        return;
                    }
                    totList.AddRange(daoThread.getData());
                    daoThread.setData(null);
                    //set daoThread is read so that next search can begin
                    daoThread.IsDataConsumed = true;
                    if (totList.Count > 0)
                    {
                        lastRecord = totList[totList.Count - 1].DocID;
                    }
                    else
                    {
                        completed = true;
                    }
                    return;
                }
            }
        }