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(); }
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(); }
public FileImporter(ImportFileInfo importFile) { _importFile = importFile; }
public ProcessWrapper(ImportFileInfo importFileInfo) { this.ImportFileInfo = importFileInfo; }
public FileImporter(ImportFileInfo importFileInfo) { this.importFileInfo = importFileInfo; }