Пример #1
0
        public void ProcessFilings(List <FilingInfo> filings)
        {
            //This does not actually lock the folder, but rather the object that refers to the folder
            //we only do this so that ProcessFilings will not run multiple times for a given instnace
            //if the service.
            lock (processingFolderInfo)
            {
                string msg = string.Format("Starting processing of {0} filings in {1}.", filings.Count, this.myServerKey);
                myEventLog.WriteEntry(msg, EventLogEntryType.Information);

                completedFilings = 0;
                foreach (FilingInfo filing in filings)
                {
                    myWokerPool.QueueUserWorkItem(this.BuildReportsCallBack, filing);
                }

                while (myWokerPool.QueuedCallbacks > 0 ||
                       myWokerPool.WaitCount < myWokerPool.MaxWorkerThreads)
                {
                    Thread.Sleep(250);
                }

                msg = string.Format("{0} has finished processing. {1} of {2} filings were completed successfully.", this.myServerKey, this.completedFilings, filings.Count);
                myEventLog.WriteEntry(msg, EventLogEntryType.Information);
            }
        }
Пример #2
0
        private void ProcessFilings(List <FilingInfo> filings)
        {
            if (filings == null || filings.Count == 0)
            {
                return;
            }

            //This does not actually lock the folder, but rather the object that refers to the folder
            //we only do this so that ProcessFilings will not run multiple times for a given instance
            //of the service.
            lock (this.processingFolderInfo)
            {
                completedFilings = 0;
                foreach (FilingInfo filing in filings)
                {
                    myWokerPool.QueueUserWorkItem(this.filingProcessor.ProcessFilingCallback, filing);

                    string msg = string.Format("Work item {0} queued for processing on server {1}.", filing.AccessionNumber, this.myServerKey);
                    WriteLogEntry(msg, EventLogEntryType.Information);
                }
            }
        }