Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/02/16 17:35:05 (7 years ago)
Author:
gkronber
Message:

#2650: merged r14422:14443 from trunk to branches resolving conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r14185 r14449  
    289289    public event EventHandler Stopped;
    290290    protected virtual void OnStopped() {
    291       foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects(new HashSet<object>() { Runs }).OfType<IStatefulItem>()) {
    292         statefulObject.ClearState();
    293       }
    294       runsCounter++;
    295       runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this));
    296       ExecutionState = ExecutionState.Stopped;
    297       EventHandler handler = Stopped;
    298       if (handler != null) handler(this, EventArgs.Empty);
     291      try {
     292        foreach (
     293          IStatefulItem statefulObject in
     294          this.GetObjectGraphObjects(new HashSet<object>() {Runs}).OfType<IStatefulItem>()) {
     295          statefulObject.ClearState();
     296        }
     297        runsCounter++;
     298        try {
     299          runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this));
     300        }
     301        catch (ArgumentException e) {
     302          OnExceptionOccurred(new InvalidOperationException("Run creation failed.", e));
     303        }
     304      }   
     305      finally {
     306        ExecutionState = ExecutionState.Stopped;
     307        EventHandler handler = Stopped;
     308        if (handler != null) handler(this, EventArgs.Empty);
     309      }
    299310    }
    300311    public event EventHandler<EventArgs<Exception>> ExceptionOccurred;
Note: See TracChangeset for help on using the changeset viewer.