Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5187


Ignore:
Timestamp:
01/02/11 04:05:04 (13 years ago)
Author:
swagner
Message:

Worked on cancellation and refactored code (#1333)

Location:
branches/ParallelEngine
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ParallelEngine/HeuristicLab.Core/3.3/Engine.cs

    r5185 r5187  
    9393        }
    9494        catch (AggregateException ex) {
    95           ex.Flatten().Handle(x => {
    96             if (!(x is OperationCanceledException)) OnExceptionOccurred(x);
    97             return true;
    98           });
     95          try {
     96            ex.Flatten().Handle(x => x is OperationCanceledException);
     97          }
     98          catch (AggregateException remaining) {
     99            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
     100            else OnExceptionOccurred(remaining);
     101          }
    99102        }
    100103        cancellationTokenSource.Dispose();
    101104        cancellationTokenSource = null;
    102         if (stopRequested) {
    103           executionStack.Clear();
    104           OnStopped();
    105         } else {
    106           if (executionStack.Count == 0) OnStopped();
    107           else OnPaused();
    108         }
     105        if (stopRequested) executionStack.Clear();
     106        if (executionStack.Count == 0) OnStopped();
     107        else OnPaused();
    109108      });
    110109    }
  • branches/ParallelEngine/HeuristicLab.ParallelEngine/3.3/ParallelEngine.cs

    r5185 r5187  
    9292          } else {
    9393            for (int i = coll.Count - 1; i >= 0; i--)
    94               if (coll[i] != null) ExecutionStack.Push(coll[i]);
     94              if (coll[i] != null) executionStack.Push(coll[i]);
    9595          }
    9696        } else if (next is IAtomicOperation) {
     
    101101          catch (Exception ex) {
    102102            executionStack.Push(operation);
    103             throw new OperatorExecutionException(operation.Operator, ex);
     103            if (ex is OperationCanceledException) throw ex;
     104            else throw new OperatorExecutionException(operation.Operator, ex);
    104105          }
    105106          if (next != null) executionStack.Push(next);
     107
     108          if (operation.Operator.Breakpoint) {
     109            string message = string.Format("Breakpoint: {0}", operation.Operator.Name != string.Empty ? operation.Operator.Name : operation.Operator.ItemName);
     110            Log.LogMessage(message);
     111            throw new OperationCanceledException(message);
     112          }
    106113        }
    107114      }
  • branches/ParallelEngine/HeuristicLab.SequentialEngine/3.3/SequentialEngine.cs

    r5185 r5187  
    6262          catch (Exception ex) {
    6363            ExecutionStack.Push(operation);
    64             throw new OperatorExecutionException(operation.Operator, ex);
     64            if (ex is OperationCanceledException) throw ex;
     65            else throw new OperatorExecutionException(operation.Operator, ex);
    6566          }
    6667          if (next != null) ExecutionStack.Push(next);
Note: See TracChangeset for help on using the changeset viewer.