Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9170 for branches/UnloadJobs


Ignore:
Timestamp:
01/16/13 14:21:14 (11 years ago)
Author:
ascheibe
Message:

#2005 fixed handling of unobservable exceptions

Location:
branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3/ConcurrentTaskDownloader.cs

    r9169 r9170  
    3939      downloadSemaphore = new Semaphore(concurrentDownloads, concurrentDownloads);
    4040      deserializeSemaphore = new Semaphore(concurrentDeserializations, concurrentDeserializations);
    41       TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException);
    4241    }
    4342
     
    102101    }
    103102
    104     private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) {
    105       e.SetObserved(); // avoid crash of process because task crashes. first exception found is handled in Results property
    106       OnExceptionOccured(new HiveException("Unobserved Exception in ConcurrentTaskDownloader", e.Exception));
    107     }
    108 
    109103    public event EventHandler<EventArgs<Exception>> ExceptionOccured;
    110104    private void OnExceptionOccured(Exception exception) {
     
    115109    #region IDisposable Members
    116110    public void Dispose() {
    117       TaskScheduler.UnobservedTaskException -= new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException);
    118111      deserializeSemaphore.Dispose();
    119112      downloadSemaphore.Dispose();
  • branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r9169 r9170  
    7676    #endregion
    7777
    78     private HiveClient() { }
     78    private HiveClient() {
     79      //this will never be deregistered
     80      TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException);
     81    }
     82
     83    private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) {
     84      e.SetObserved(); // avoid crash of process because task crashes. first exception found is handled in Results property
     85      throw new HiveException("Unobserved Exception in ConcurrentTaskDownloader", e.Exception);
     86    }
    7987
    8088    public void ClearHiveClient() {
  • branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3/TaskDownloader.cs

    r9169 r9170  
    123123      taskDownloader.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(taskDownloader_ExceptionOccured);
    124124      resultsLock.Dispose();
     125      taskDownloader.Dispose();
    125126    }
    126127    #endregion
Note: See TracChangeset for help on using the changeset viewer.