Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/28/08 12:21:16 (16 years ago)
Author:
gkronber
Message:

fixed #34 by not extending ProcessingEngine from ThreadParallelEngine. This also has the benefit that Grid and DistributedEngine are not dependent on ThreadParallelEngine anymore.

Location:
trunk/sources/HeuristicLab.Grid
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Grid/HeuristicLab.Grid.csproj

    r4 r27  
    8383      <Name>HeuristicLab.PluginInfrastructure</Name>
    8484    </ProjectReference>
    85     <ProjectReference Include="..\HeuristicLab.ThreadParallelEngine\HeuristicLab.ThreadParallelEngine.csproj">
    86       <Project>{6E757D0E-20F9-4E89-AF06-D7DA256870DB}</Project>
    87       <Name>HeuristicLab.ThreadParallelEngine</Name>
    88     </ProjectReference>
    8985  </ItemGroup>
    9086  <ItemGroup>
  • trunk/sources/HeuristicLab.Grid/HeuristicLabGridPlugin.cs

    r2 r27  
    3030  [PluginFile(Filename = "HeuristicLab.Grid.dll", Filetype = PluginFileType.Assembly)]
    3131  [Dependency(Dependency = "HeuristicLab.Core")]
    32   [Dependency(Dependency = "HeuristicLab.ThreadParallelEngine")]
    3332  public class HeuristicLabGridPlugin : PluginBase {
    3433  }
  • trunk/sources/HeuristicLab.Grid/ProcessingEngine.cs

    r2 r27  
    2626using HeuristicLab.Core;
    2727using System.Xml;
     28using System.Threading;
    2829
    2930namespace HeuristicLab.Grid {
    30   public class ProcessingEngine : ThreadParallelEngine.ThreadParallelEngine {
    31 
     31  public class ProcessingEngine : EngineBase {
    3232    private AtomicOperation initialOperation;
    3333    public AtomicOperation InitialOperation {
     
    5656      initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects);
    5757    }
     58
     59    protected override void ProcessNextOperation() {
     60      IOperation operation = myExecutionStack.Pop();
     61      if(operation is AtomicOperation) {
     62        AtomicOperation atomicOperation = (AtomicOperation)operation;
     63        IOperation next = null;
     64        try {
     65          next = atomicOperation.Operator.Execute(atomicOperation.Scope);
     66        } catch(Exception ex) {
     67          // push operation on stack again
     68          myExecutionStack.Push(atomicOperation);
     69          Abort();
     70          ThreadPool.QueueUserWorkItem(delegate(object state) { OnExceptionOccurred(ex); });
     71        }
     72        if(next != null)
     73          myExecutionStack.Push(next);
     74        OnOperationExecuted(atomicOperation);
     75        if(atomicOperation.Operator.Breakpoint) Abort();
     76      } else if(operation is CompositeOperation) {
     77        CompositeOperation compositeOperation = (CompositeOperation)operation;
     78        for(int i = compositeOperation.Operations.Count - 1; i >= 0; i--)
     79          myExecutionStack.Push(compositeOperation.Operations[i]);
     80      }
     81    }
    5882  }
    5983}
Note: See TracChangeset for help on using the changeset viewer.