private void ProcessFile(ImportFileInfo importFileInfo)
        {
            importFileInfo.MoveToFolder(ServiceConfiguration.Instance.StagingFilePath);

            var processWrapper = new ProcessWrapper(importFileInfo);

            processWrapper.SetLogger(_logger);

            processWrapper.OnTerminate += (sender, terminatingImportFile) =>
            {
                ProcessWrapper tmp = null;
                _processRegistry.TryRemove(terminatingImportFile.Abi, out tmp);
            };

            //Interlocked.Increment(ref _numRunningThread);
            _processRegistry[importFileInfo.Abi] = processWrapper;
            processWrapper.Start();
        }
示例#2
0
        private void StartProcess(ImportFileInfo file)
        {
            file.MoveToFolder(ServiceConfiguration.Instance.StagingFilePath);

            //Log("Sposto il file in " + stagingFilePath);

            var importer = new FileImporter(file);

            importer.SetLogger(_logger);

            var processingThread = new Thread(() =>
            {
                try
                {
                    importer.Import();
                }catch (Exception ex)
                {
                    Log("Errore su thread");
                }
                finally
                {
                    lock (_lock)
                    {
                        _numRunningThreads--;
                        _companyRegistry.Remove(file.Company);
                    }

                    //Interlocked.Decrement(ref _numRunningThreads);

                    LogThreads();
                }
            });

            lock (_lock)
            {
                _numRunningThreads++;
                _companyRegistry.Add(file.Company);
            }

            //Interlocked.Increment(ref _numRunningThreads);


            processingThread.Start();
        }
示例#3
0
 public FileImporter(ImportFileInfo importFile)
 {
     _importFile = importFile;
 }
示例#4
0
 public ProcessWrapper(ImportFileInfo importFileInfo)
 {
     this.ImportFileInfo = importFileInfo;
 }
示例#5
0
 public FileImporter(ImportFileInfo importFileInfo)
 {
     this.importFileInfo = importFileInfo;
 }