Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7782


Ignore:
Timestamp:
05/04/12 17:57:40 (13 years ago)
Author:
ascheibe
Message:

#1722 fixed a NullReferenceException in Hive JobManager

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r7582 r7782  
    6969      Content.IsAllowedPrivilegedChanged += new EventHandler(Content_IsAllowedPrivilegedChanged);
    7070      Content.Loaded += new EventHandler(Content_Loaded);
     71      Content.TaskReceived += new EventHandler(Content_TaskReceived);
    7172    }
    7273
     
    8384      Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
    8485      Content.Loaded -= new EventHandler(Content_Loaded);
     86      Content.TaskReceived -= new EventHandler(Content_TaskReceived);
    8587      base.DeregisterContentEvents();
    8688    }
     
    167169
    168170    #region Content Events
     171    void Content_TaskReceived(object sender, EventArgs e) {
     172      runCollectionViewHost.Content = GetAllRunsFromJob(Content);
     173    }
     174
    169175    private void HiveTasks_ItemsAdded(object sender, CollectionItemsChangedEventArgs<HiveTask> e) {
    170176      if (InvokeRequired)
    171177        Invoke(new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsAdded), sender, e);
    172178      else {
    173         foreach (HiveTask t in e.Items) {
    174           t.TaskStateChanged += new EventHandler(HiveTask_TaskStateChanged);
    175         }
    176179        SetEnabledStateOfControls();
    177180      }
     
    182185        Invoke(new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_ItemsRemoved), sender, e);
    183186      else {
    184         foreach (HiveTask t in e.Items) {
    185           t.TaskStateChanged -= new EventHandler(HiveTask_TaskStateChanged);
    186         }
    187187        SetEnabledStateOfControls();
    188188      }
     
    193193        Invoke(new CollectionItemsChangedEventHandler<HiveTask>(HiveTasks_CollectionReset), sender, e);
    194194      else {
    195         foreach (HiveTask t in e.Items) {
    196           t.TaskStateChanged -= new EventHandler(HiveTask_TaskStateChanged);
    197         }
    198         SetEnabledStateOfControls();
    199       }
    200     }
    201 
    202     void HiveTask_TaskStateChanged(object sender, EventArgs e) {
    203       runCollectionViewHost.Content = GetAllRunsFromJob(Content);
     195        SetEnabledStateOfControls();
     196      }
    204197    }
    205198
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveTasks/OptimizerHiveTask.cs

    r7259 r7782  
    3131namespace HeuristicLab.Clients.Hive {
    3232  public class OptimizerHiveTask : HiveTask<OptimizerTask> {
     33
     34    Object batchRunLocker = new Object();
    3335
    3436    #region Constructors and Cloning
     
    224226        batchRun.Optimizer = (IOptimizer)optimizerTask.Item; // only set the first optimizer as Optimizer. if every time the Optimizer would be set, the runs would be cleared each time
    225227      }
    226       foreach (IRun run in optimizerTask.Item.Runs) {
    227         if (!batchRun.Runs.Contains(run)) {
    228           run.Name = GetNewRunName(run, batchRun.Runs);
    229           batchRun.Runs.Add(run);
     228      lock (batchRunLocker) {
     229        foreach (IRun run in optimizerTask.Item.Runs) {
     230          if (!batchRun.Runs.Contains(run)) {
     231            run.Name = GetNewRunName(run, batchRun.Runs);
     232            batchRun.Runs.Add(run);
     233          }
    230234        }
    231235      }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs

    r7582 r7782  
    316316      UpdateStatistics();
    317317      OnStateLogListChanged();
     318      OnTaskReceived();
    318319    }
    319320
     
    469470      if (handler != null) handler(this, EventArgs.Empty);
    470471    }
     472    public event EventHandler TaskReceived;
     473    protected virtual void OnTaskReceived() {
     474      var handler = TaskReceived;
     475      if (handler != null) handler(this, EventArgs.Empty);
     476    }
    471477    #endregion
    472478
Note: See TracChangeset for help on using the changeset viewer.