- Timestamp:
- 06/16/11 14:20:48 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r6419 r6431 117 117 <Compile Include="StateLogList.cs" /> 118 118 <Compile Include="StateLogListList.cs" /> 119 <Compile Include="ThreadSafeLog.cs" />120 119 <None Include="app_f005pc.config" /> 121 120 <None Include="app_services.config" /> 122 121 <None Include="app.config" /> 122 <None Include="ClassDiagram2.cd" /> 123 123 <None Include="HeuristicLabClientsHivePlugin.cs.frame" /> 124 124 <Compile Include="Exceptions\AddJobToHiveException.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs
r6419 r6431 82 82 } 83 83 84 private ILog log;84 private ThreadSafeLog log; 85 85 public ILog Log { 86 86 get { return log; } 87 set { log = value; } 88 } 89 private static object logLocker = new object(); 87 } 90 88 91 89 #region Constructors and Cloning … … 93 91 this.refreshAutomatically = true; 94 92 this.HiveExperiment = new HiveExperiment(); 95 this.log = new Log();93 this.log = new ThreadSafeLog(new Log()); 96 94 this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2); 97 95 this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured); … … 100 98 this.refreshAutomatically = true; 101 99 this.HiveExperiment = hiveExperiment; 102 this.log = new Log();100 this.log = new ThreadSafeLog(new Log()); 103 101 this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2); 104 102 this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured); … … 108 106 this.HiveExperiment = original.HiveExperiment; 109 107 this.IsControllable = original.IsControllable; 110 this. Log = cloner.Clone(original.Log);108 this.log = cloner.Clone(original.log); 111 109 this.RefreshAutomatically = false; // do not start results polling automatically 112 110 this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2); … … 180 178 181 179 if (!hiveJob.IsFinishedJobDownloaded && !hiveJob.IsDownloading && hiveJob.Job.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) { 182 LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));180 log.LogMessage(string.Format("Downloading job {0}", lightweightJob.Id)); 183 181 hiveJob.IsDownloading = true; 184 182 jobDownloader.DownloadJob(hiveJob.Job, (localJob, itemJob) => { 185 LogMessage(string.Format("Finished downloading job {0}", localJob.Id));183 log.LogMessage(string.Format("Finished downloading job {0}", localJob.Id)); 186 184 HiveJob localHiveJob = GetHiveJobById(localJob.Id); 187 185 … … 222 220 } 223 221 224 // synchronized logging225 private void LogException(Exception exception) {226 lock (logLocker) {227 this.log.LogException(exception);228 }229 }230 // synchronized logging231 private void LogMessage(string message) {232 lock (logLocker) {233 this.log.LogMessage(message);234 }235 }236 237 222 public HiveJob GetHiveJobById(Guid jobId) { 238 223 foreach (HiveJob job in hiveExperiment.HiveJobs) { … … 356 341 public event EventHandler<EventArgs<Exception>> ExceptionOccured; 357 342 private void OnExceptionOccured(Exception exception) { 358 LogException(exception);343 log.LogException(exception); 359 344 var handler = ExceptionOccured; 360 345 if (handler != null) handler(this, new EventArgs<Exception>(exception)); … … 390 375 get { return hiveExperiment.ItemVersion; } 391 376 } 392 393 377 394 378 #region IProgressReporter Members 395 379 public IProgress Progress {
Note: See TracChangeset
for help on using the changeset viewer.