예제 #1
0
        void _jobResultReciver_OnJobResultRecive(Quax.JobResult result)
        {
            // Inform JobDispatcher for this event
            _jobDispatcher.JobResultRecived(result);

            // Raise "Quax.JobResultRecive" event
            EventExtensions.Raise(JobResultRecive, new object[] { result });
        }
예제 #2
0
        public void Shutdown()
        {
            _jobDispatcher.Shutdown();
            _jobResultReciver.Stop();

            // Generate JobDispatcherShutdownLog Log
            Log.JobDispatcherShutdownLog log = new Log.JobDispatcherShutdownLog();
            log.Message = "Shutdown request sent to the job dispatcher.";
            EventExtensions.Raise(NewLogItem, new object[] { log });
        }
예제 #3
0
        void _controlUnit_OnNewLogItem(Quax.Log log)
        {
            // Inform JobDispatcher for this event
            if (log is Log.WorkerRegisterationRequestLog)
            {
                _jobDispatcher.HandleWorkerRegistrationRequest(((Log.WorkerRegisterationRequestLog)log).Sender);
            }

            // Raise "Quax.JobResultRecive" event
            EventExtensions.Raise(NewLogItem, new object[] { log });
        }
예제 #4
0
        /// <summary>
        /// Stops the process of dispatching jobs. the process can be resumed by calling StartDispatch().
        /// </summary>
        public void StopDispatch()
        {
            _controlUnit.Stop();
            _jobResultReciver.Stop();
            _jobDispatcher.StopDispatch();

            // Generate JobDispatcherStoppedLog Log
            Log.JobDispatcherStoppedLog log = new Log.JobDispatcherStoppedLog();
            log.Message = "Stop request sent to the job dispatcher.";
            EventExtensions.Raise(NewLogItem, new object[] { log });
        }
예제 #5
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 });
            }
        }
예제 #6
0
 void _jobDispatcher_OnNewLogItem(Quax.Log l)
 {
     // Raise "Quax.NewLogItem" event
     EventExtensions.Raise(NewLogItem, new object[] { l });
 }