Ejemplo n.º 1
0
        private bool FetchData()
        {
            EventHandler eventHandler = null;
            int          count        = this.m_runtimeDataSources.Count;
            ThreadSet    threadSet    = null;

            try
            {
                if (this.m_odpContext.AbortInfo != null)
                {
                    eventHandler = this.AbortHandler;
                    this.m_odpContext.AbortInfo.ProcessingAbortEvent += eventHandler;
                }
                if (count != 0)
                {
                    RuntimeAtomicDataSource @object;
                    if (count > 1)
                    {
                        threadSet = new ThreadSet(count - 1);
                        try
                        {
                            for (int i = 1; i < count; i++)
                            {
                                @object = this.m_runtimeDataSources[i];
                                threadSet.TryQueueWorkItem(this.m_odpContext, @object.ProcessConcurrent);
                            }
                        }
                        catch (Exception e)
                        {
                            if (this.m_odpContext.AbortInfo != null)
                            {
                                this.m_odpContext.AbortInfo.SetError(e, this.m_odpContext.ProcessingAbortItemUniqueIdentifier);
                            }
                            throw;
                        }
                    }
                    @object = this.m_runtimeDataSources[0];
                    @object.ProcessConcurrent(null);
                }
            }
            finally
            {
                if (threadSet != null && count > 1)
                {
                    threadSet.WaitForCompletion();
                    threadSet.Dispose();
                }
                if (eventHandler != null)
                {
                    this.m_odpContext.AbortInfo.ProcessingAbortEvent -= eventHandler;
                }
            }
            this.m_odpContext.CheckAndThrowIfAborted();
            return(true);
        }
Ejemplo n.º 2
0
        private void ExecuteParallelDataSets()
        {
            ThreadSet threadSet = new ThreadSet(base.m_runtimeDataSets.Count - 1);

            try
            {
                for (int i = 1; i < base.m_runtimeDataSets.Count; i++)
                {
                    RuntimeAtomicDataSet runtimeAtomicDataSet = (RuntimeAtomicDataSet)base.m_runtimeDataSets[i];
                    runtimeAtomicDataSet.InitProcessingParams(null, base.m_transaction);
                    threadSet.TryQueueWorkItem(base.m_odpContext, runtimeAtomicDataSet.ProcessConcurrent);
                }
                RuntimeAtomicDataSet runtimeAtomicDataSet2 = (RuntimeAtomicDataSet)base.m_runtimeDataSets[0];
                runtimeAtomicDataSet2.InitProcessingParams(base.m_connection, base.m_transaction);
                runtimeAtomicDataSet2.ProcessConcurrent(null);
            }
            catch (Exception e)
            {
                if (base.m_odpContext.AbortInfo != null)
                {
                    base.m_odpContext.AbortInfo.SetError(e, base.m_odpContext.ProcessingAbortItemUniqueIdentifier);
                }
                throw;
            }
            finally
            {
                threadSet.WaitForCompletion();
                threadSet.Dispose();
            }
            if (this.NeedsExecutionLogging && base.m_odpContext.JobContext != null)
            {
                DataProcessingMetrics dataProcessingMetrics = null;
                for (int j = 0; j < base.m_runtimeDataSets.Count; j++)
                {
                    RuntimeDataSet runtimeDataSet = base.m_runtimeDataSets[j];
                    if (dataProcessingMetrics == null || runtimeDataSet.DataSetExecutionMetrics.TotalDurationMs > dataProcessingMetrics.TotalDurationMs)
                    {
                        dataProcessingMetrics = runtimeDataSet.DataSetExecutionMetrics;
                    }
                }
                base.m_executionMetrics.Add(dataProcessingMetrics);
            }
        }