Ignore:
Timestamp:
Jun 10, 2010, 3:26:32 PM (11 years ago)
Author:
kopal
Message:
  • a delete of a plugin now leads to the delete of all left connections
  • added a first version of a Settings to the WorkspaceManager
  • some small bug fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/WorkspaceManager/Execution/ExecutionEngine.cs

    r1608 r1617  
    3232    /// <summary>
    3333    /// Engine to execute a model of the WorkspaceManager
     34    /// This class needs a WorkspaceManager to be instantiated
     35    /// To run an execution process it also needs a WorkspaceModel
     36    ///
     37    /// This class uses Gears4Net to execute the plugins
    3438    /// </summary>
    3539    public class ExecutionEngine
     
    5862
    5963        /// <summary>
    60         /// Execute the current Model
     64        /// Execute the given Model
    6165        /// </summary>
    6266        /// <param name="workspaceModel"></param>
     
    6973                IsRunning = true;
    7074
     75                //Here we create n = "ProcessorsCount * 2" Gears4Net schedulers
     76                //We do this, because measurements showed that we get the best performance if we
     77                //use this amount of schedulers
    7178                schedulers = new Scheduler[System.Environment.ProcessorCount*2];
    7279                for(int i=0;i<System.Environment.ProcessorCount*2;i++){
     
    7481                }
    7582
     83                //We have to reset all states of PluginModels, ConnectorModels and ConnectionModels:
    7684                workspaceModel.resetStates();
     85
     86                //The UpdateGuiProtocol is a kind of "daemon" which will update the view elements if necessary
    7787                UpdateGuiProtocol updateGuiProtocol = new UpdateGuiProtocol(schedulers[0], workspaceModel, this);
    7888                schedulers[0].AddProtocol(updateGuiProtocol);
    7989                updateGuiProtocol.Start();
    8090
     91                //The CheckExecutableProtocl is also a kind of "daemon" which will check from time to time if a
     92                //plugin can be executed again
    8193                CheckExecutableProtocol checkExecutableProtocol = new CheckExecutableProtocol(schedulers[0], workspaceModel, this);
    8294                schedulers[0].AddProtocol(checkExecutableProtocol);
    8395                checkExecutableProtocol.Start();
    8496
     97                //Here we create for each PluginModel an own PluginProtocol
     98                //By using round-robin we give each protocol to another scheduler to gain
     99                //a good average load balancing of the schedulers
    85100                int counter=0;
    86101                foreach (PluginModel pluginModel in workspaceModel.AllPluginModels)
     
    97112     
    98113        /// <summary>
    99         /// Stop the execution
     114        /// Stop the execution process:
     115        /// calls shutdown on all schedulers + calls stop() on each plugin
    100116        /// </summary>
    101117        public void Stop()
     
    219235
    220236    /// <summary>
    221     /// A Protocol for updating the GUI in time intervals
     237    /// A Protocol for checking if plugins are executable in time intervals
    222238    /// </summary>
    223239    public class CheckExecutableProtocol : ProtocolBase
     
    287303        /// <summary>
    288304        /// The main function of the protocol
     305        ///
     306        /// states are here:
     307        ///
     308        ///     PreExecution -> Execution -> PostExecution
     309        ///        /\                           |
     310        ///         |---------------------------|
     311        ///         
    289312        /// </summary>
    290313        /// <param name="stateMachine"></param>
     
    307330
    308331        /// <summary>
    309         /// Handler function for a message.
    310         /// This handler must not block, because it executes inside the thread of the scheduler.
     332        /// Call the pre execution function of the wrapped IPlugin
    311333        /// </summary>
    312334        /// <param name="msg"></param>
     
    318340
    319341        /// <summary>
    320         /// Handler function for a message.
    321         /// This handler must not block, because it executes inside the thread of the scheduler.
     342        /// Call the execution function of the wrapped IPlugin
    322343        /// </summary>
    323344        /// <param name="msg"></param>
     
    343364
    344365        /// <summary>
    345         /// Handler function for a message.
    346         /// This handler must not block, because it executes inside the thread of the scheduler.
     366        /// Call the post execution function of the wrapped IPlugin
    347367        /// </summary>
    348368        /// <param name="msg"></param>
Note: See TracChangeset for help on using the changeset viewer.