private bool FetchData()
        {
            EventHandler eventHandler = null;
            int          count        = m_runtimeDataSources.Count;
            ThreadSet    threadSet    = null;

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

            try
            {
                for (int i = 1; i < m_runtimeDataSets.Count; i++)
                {
                    RuntimeAtomicDataSet runtimeAtomicDataSet = (RuntimeAtomicDataSet)m_runtimeDataSets[i];
                    runtimeAtomicDataSet.InitProcessingParams(null, m_transaction);
                    threadSet.TryQueueWorkItem(m_odpContext, runtimeAtomicDataSet.ProcessConcurrent);
                }
                RuntimeAtomicDataSet obj = (RuntimeAtomicDataSet)m_runtimeDataSets[0];
                obj.InitProcessingParams(m_connection, m_transaction);
                obj.ProcessConcurrent(null);
            }
            catch (Exception e)
            {
                if (m_odpContext.AbortInfo != null)
                {
                    m_odpContext.AbortInfo.SetError(e, m_odpContext.ProcessingAbortItemUniqueIdentifier);
                }
                throw;
            }
            finally
            {
                threadSet.WaitForCompletion();
                threadSet.Dispose();
            }
            if (!NeedsExecutionLogging || m_odpContext.JobContext == null)
            {
                return;
            }
            DataProcessingMetrics dataProcessingMetrics = null;

            for (int j = 0; j < m_runtimeDataSets.Count; j++)
            {
                RuntimeDataSet runtimeDataSet = m_runtimeDataSets[j];
                if (dataProcessingMetrics == null || runtimeDataSet.DataSetExecutionMetrics.TotalDurationMs > dataProcessingMetrics.TotalDurationMs)
                {
                    dataProcessingMetrics = runtimeDataSet.DataSetExecutionMetrics;
                }
            }
            m_executionMetrics.Add(dataProcessingMetrics);
        }