Ejemplo n.º 1
0
        public ControllerEngine(bool startSynchronization, int syncFrequency)
        {
            _JobManager					= new JobManager();
            _Broker						= new Broker();
            _PluginThreadBlocker		= new AutoResetEvent(false);

            IsDisposed					= false;
            _ShouldRunPlugins			= startSynchronization;

            _PluginThread				= new Thread(CheckAllPluginsAndRunRunablesLoop);
            _PluginThread.Name			= "Controller Thread";

            JobManager.JobAddedToQueue	+= JobManager_JobAddedToQueue;
            Broker.ExecuteCompleted		+= Broker_PluginOperationEnded;
            Broker.ExecuteFailed		+= Broker_PluginOperationEnded;
            Broker.CommitCompleted		+= Broker_PluginOperationEnded;
            Broker.CommitFailed			+= Broker_PluginOperationEnded;
            Broker.RollbackCompleted	+= Broker_PluginOperationEnded;
            Broker.RollbackFailed		+= Broker_PluginOperationEnded;

            InitializeAgents();

            if (startSynchronization)
                _JobManager.BeginSynchronize(syncFrequency);
        }