- Timestamp:
- 12/20/11 13:54:57 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive/3.3
- Property svn:ignore
-
old new 1 1 obj 2 2 Plugin.cs 3 bin
-
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive/3.3/TaskDownloader.cs
r6976 r7215 25 25 using HeuristicLab.Clients.Hive.Jobs; 26 26 using HeuristicLab.Common; 27 using System.Threading; 27 28 28 29 namespace HeuristicLab.Clients.Hive { … … 33 34 private bool exceptionOccured = false; 34 35 private Exception currentException; 36 private ReaderWriterLockSlim resultsLock = new ReaderWriterLockSlim(); 35 37 36 38 public bool IsFinished { 37 39 get { 38 return results.Count == taskIds.Count(); 40 try { 41 resultsLock.EnterReadLock(); 42 return results.Count == taskIds.Count(); 43 } finally { resultsLock.ExitReadLock(); } 39 44 } 40 45 } … … 51 56 } 52 57 } 53 58 54 59 public int FinishedCount { 55 60 get { 56 return results.Count; 61 try { 62 resultsLock.EnterReadLock(); 63 return results.Count; 64 } finally { resultsLock.ExitReadLock(); } 57 65 } 58 66 } … … 60 68 public IDictionary<Guid, HiveTask> Results { 61 69 get { 62 return results; 70 try { 71 resultsLock.EnterReadLock(); 72 return results; 73 } finally { resultsLock.ExitReadLock(); } 63 74 } 64 75 } … … 66 77 public TaskDownloader(IEnumerable<Guid> jobIds) { 67 78 this.taskIds = jobIds; 68 this.taskDownloader = new ConcurrentTaskDownloader<ItemTask>( 2, 2);79 this.taskDownloader = new ConcurrentTaskDownloader<ItemTask>(Settings.Default.MaxParallelDownloads, Settings.Default.MaxParallelDownloads); 69 80 this.taskDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(taskDownloader_ExceptionOccured); 70 81 this.results = new Dictionary<Guid, HiveTask>(); 71 82 } 72 83 73 84 public void StartAsync() { 74 85 foreach (Guid taskId in taskIds) { 75 Task task = ServiceLocator.Instance.CallHiveService(s => s.GetTask(taskId)); 76 77 taskDownloader.DownloadTask(task, 86 taskDownloader.DownloadTaskDataAndTask(taskId, 78 87 (localJob, itemJob) => { 79 88 if (localJob != null && itemJob != null) { … … 85 94 } 86 95 hiveTask.Task = localJob; 87 this.results.Add(localJob.Id, hiveTask); 96 try { 97 resultsLock.EnterWriteLock(); 98 this.results.Add(localJob.Id, hiveTask); 99 } finally { resultsLock.ExitWriteLock(); } 88 100 } 89 101 }); 90 } 102 } 91 103 } 92 104
Note: See TracChangeset
for help on using the changeset viewer.