Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14800 for stable


Ignore:
Timestamp:
03/30/17 16:54:05 (7 years ago)
Author:
mkommend
Message:

#2711: Merged r14433 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Optimization

  • stable/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r14186 r14800  
    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.