Beispiel #1
0
        }//private void ProcessFileWatcher(object sender, FileSystemEventArgs e)

        /// <summary>
        /// ProcessJobControlFileThread:Method that blocks on the file Q waiting for a file
        /// to be queued up that needs to be processed.
        /// </summary>
        private void ProcessJobControlFileThread()
        {
            string fName = String.Empty;

            try
            {
                while (true)
                {
                    fName = String.Empty;
                    try
                    {
                        if (m_fileNameQ.Count > 0)
                        {
                            // lock the root
                            lock (m_fileNameQ.SyncRoot)
                            {
                                // m_logger.WriteToLogFile("-NFORMATIONAL::AMSHandler::ProcessJobControlFileThread():DequeuingTheFileToProcess");
                                // dequeue the next filename to process
                                fName = (string)m_fileNameQ.Dequeue();
                            }//lock(m_fileNameQ.SyncRoot)
                        }

                        //create the command string
                        if (fName != String.Empty && fName.Contains("IPDR"))
                        {
                            // process the file:
                            // read the MAF records
                            // update the database with the MAF records
                            m_rdr.ProcessTheFile(fName);

                            // move the file to the processed directory
                            this.MoveTheFile(fName);

                            // update the database to show we've processed this file
                            string f = this.ParseFileName(fName);
                            m_dbMgr.AddAmsFile(f);
                        }
                    }//try
                    catch (System.Threading.ThreadAbortException te)
                    {
                        m_logger.WriteToLogFile("-NEXCEPTIONCAUGHT::AMSHandler::ProcessJobControlFileThread():ExceptionCaught:ThreadAbortExceptionCaught" + te.Message + te.StackTrace);
                        return;
                    }
                    catch (System.Exception ex)
                    {// generic system exception
                        m_logger.WriteToLogFile("-NEXCEPTIONCAUGHT::AMSHandler::ProcessJobControlFileThread():ExceptionCaught:SystemExceptionCaught" + ex.Message + ex.StackTrace);
                    }

                    System.Threading.Thread.Sleep(m_ProcessThreadIntervalInMSecs);
                }// while(true)
            }

            catch (System.Threading.ThreadAbortException te)
            {
                m_logger.WriteToLogFile("-NEXCEPTIONCAUGHT::AMSHandler::ProcessJobControlFileThread():ExceptionCaught:ThreadAbortExceptionCaught" + te.Message + te.StackTrace);
            }

            catch (System.Exception ex)
            {
                m_logger.WriteToLogFile("-NEXCEPTIONCAUGHT::AMSHandler::ProcessJobControlFileThread():ExceptionCaught:SystemExceptionCaught" + ex.Message + ex.StackTrace);
            } // catch
        }     // private void ProcessJobControlFile()
Beispiel #2
0
 private void UpdateDb(string fileName)
 {
     m_dbMgr.AddAmsFile(fileName);
 }