Changeset 27


Ignore:
Timestamp:
02/28/08 12:21:16 (13 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
Files:
5 edited

Legend:

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

    r4 r27  
    7272      <Name>HeuristicLab.PluginInfrastructure</Name>
    7373    </ProjectReference>
    74     <ProjectReference Include="..\HeuristicLab.ThreadParallelEngine\HeuristicLab.ThreadParallelEngine.csproj">
    75       <Project>{6E757D0E-20F9-4E89-AF06-D7DA256870DB}</Project>
    76       <Name>HeuristicLab.ThreadParallelEngine</Name>
    77     </ProjectReference>
    7874  </ItemGroup>
    7975  <ItemGroup>
  • trunk/sources/HeuristicLab.DistributedEngine/HeuristicLabDistributedEnginePlugin.cs

    r14 r27  
    3030  [Dependency(Dependency = "HeuristicLab.Core")]
    3131  [Dependency(Dependency = "HeuristicLab.Grid")]
    32   [Dependency(Dependency = "HeuristicLab.ThreadParallelEngine")]
    3332  public class HeuristicLabDistributedEnginePlugin : PluginBase {
    3433  }
  • 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.