Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6199 for branches


Ignore:
Timestamp:
05/15/11 14:33:42 (14 years ago)
Author:
cneumuel
Message:

#1233

  • fixed synchronization issues with logging
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs

    r6198 r6199  
    101101      set { log = value; }
    102102    }
     103    private static object logLocker = new object();
    103104   
    104105
     
    188189
    189190          if (!hiveJob.IsFinishedJobDownloaded && !hiveJob.IsDownloading && hiveJob.Job.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) {
    190             log.LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));
     191            LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));
    191192            hiveJob.IsDownloading = true;
    192193            jobDownloader.DownloadJob(hiveJob.Job, (localJob, itemJob, exception) => {
    193               log.LogMessage(string.Format("Finished downloading job {0}", localJob.Id));
     194              LogMessage(string.Format("Finished downloading job {0}", localJob.Id));
    194195              HiveJob localHiveJob = GetHiveJobById(localJob.Id);
    195196
    196197              if (exception != null) {
    197                 log.LogException(exception);
     198                var ex = new ConcurrentJobDownloaderException("Downloading job failed.", exception);
     199                LogException(ex);
    198200                localHiveJob.IsDownloading = false;
    199                 throw new ConcurrentJobDownloaderException("Downloading job failed.", exception);
     201                throw ex;
    200202              }
    201203
     
    232234    }
    233235
     236    // synchronized logging
     237    private void LogException(Exception exception) {
     238      lock (logLocker) {
     239        log.LogException(exception);
     240      }
     241    }
     242    // synchronized logging
     243    private void LogMessage(string message) {
     244      lock (logLocker) {
     245        log.LogMessage(message);
     246      }
     247    }
     248
    234249    public HiveJob GetHiveJobById(Guid jobId) {
    235250      foreach (HiveJob job in hiveExperiment.HiveJobs) {
Note: See TracChangeset for help on using the changeset viewer.