Exemplo n.º 1
0
        /// <summary>
        /// Starts the process of dispatching jobs to the workers for computing.
        /// </summary>
        /// <exception cref="">
        /// InvalidOperationException
        /// </exception>
        public void StartDispatch()
        {
            _jobResultReciver.DataChannelPortNumber = this.DataChannelPortNumber;

            try {
                _jobResultReciver.Start(); // This method may throw exception.
                _controlUnit.Start();      // This method may throw exception.
                _jobDispatcher.StartDispatch();

                // Generate JobDispatcherStartedLog Log
                Log.JobDispatcherStartedLog log = new Log.JobDispatcherStartedLog();
                log.Message = "Job dispatcher started.";
                EventExtensions.Raise(NewLogItem, new object[] { log });
            }
            catch (Exception e) {
                // Generate JobDispatcherCouldNotStartLog Log
                Log.JobDispatcherCouldNotStartLog log = new Log.JobDispatcherCouldNotStartLog();
                log.Message      = "Job dispatcher could not start.";
                log.ErrorMessage = e.Message;
                EventExtensions.Raise(NewLogItem, new object[] { log });
            }
        }