Ejemplo n.º 1
0
        /// <summary>
        /// This method is called by UpdateGraphAsyncTask in the context of
        /// ISchedulerThread to kick start an update through LiveRunner.
        /// </summary>
        /// <param name="graphSyncData">The GraphSyncData that was generated by
        /// a prior call to ComputeSyncData at the time UpdateGraphAsyncTask was
        /// scheduled.</param>
        ///
        public void UpdateGraphImmediate(GraphSyncData graphSyncData)
        {
            // NOTE: We will not attempt to catch any unhandled exception from
            // within the execution. Such exception, if any, will be caught by
            // DynamoScheduler.ProcessTaskInternal.

            liveRunnerServices.UpdateGraph(graphSyncData);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update graph with graph sync data.
        /// </summary>
        /// <param name="fatalException">The exception that is not handled
        /// anywhere within the LiveRunnerServices.UpdateGraph method. This
        /// parameter will always be set to null if there is no unhandled
        /// exception thrown from within the UpdateGraph call.</param>
        /// <returns>Returns true if any update has taken place, or false
        /// otherwise.</returns>
        ///
        public bool UpdateGraph(ref Exception fatalException)
        {
            lock (MacroMutex)
            {
                bool updated = false;
                fatalException = null;

                ClearWarnings();

                lock (graphSyncDataQueue)
                {
                    while (graphSyncDataQueue.Count > 0)
                    {
                        try
                        {
                            var data = graphSyncDataQueue.Dequeue();
                            liveRunnerServices.UpdateGraph(data);
                            updated = true;
                        }
                        catch (Exception e)
                        {
                            // The exception that is not handled within the UpdateGraph
                            // method is recorded here. The only thing for now is, we
                            // are only interested in the first unhandled exception.
                            // This decision may change in the future if we decided to
                            // clear up "graphSyncDataQueue" whenever there is a fatal
                            // exception?
                            //
                            if (fatalException == null)
                            {
                                fatalException = e;
                            }

                            dynSettings.DynamoLogger.Log("Update graph failed: " + e.Message);
                        }
                    }
                }

                if (updated)
                {
                    ShowRuntimeWarnings();
                }

                return(updated);
            }
        }