示例#1
0
        public DataService(ITracer tracer, IPqlEngineHostProcess process, string instanceName, int maxEngineConcurrency, IDataEngineCache dataEngineCache)
        {
            if (tracer == null)
            {
                throw new ArgumentNullException("tracer");
            }

            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            if (string.IsNullOrEmpty(instanceName))
            {
                throw new ArgumentNullException("instanceName");
            }

            if (maxEngineConcurrency <= 0 || maxEngineConcurrency > 10000)
            {
                throw new ArgumentOutOfRangeException("maxEngineConcurrency", maxEngineConcurrency, "Invalid value");
            }

            m_protocolVersion = "default";
            m_tracer = tracer;

            m_cancellationTokenSource = new CancellationTokenSource();
            m_process = process;
            m_instanceName = instanceName;
            m_maxEngineConcurrency = maxEngineConcurrency;

            m_counters = new RawDataWriterPerfCounters(instanceName);

            m_requestManagers = new RequestProcessingManager[maxEngineConcurrency];

            // request processing managers will not be dynamically created,
            // this is to explicitly limit concurrency regardless of service infrastructure settings
            m_requestManagersPool = new ObjectPool<RequestProcessingManager>(m_maxEngineConcurrency, null);
            for (var i = 0; i < m_requestManagersPool.Capacity; i++)
            {
                m_requestManagers[i] = new RequestProcessingManager(m_tracer, m_process, m_counters);
                m_requestManagersPool.Return(m_requestManagers[i]);
            }

            m_enginesCache = dataEngineCache ?? new DataEngineCache(m_tracer, m_instanceName, m_maxEngineConcurrency);
        }
        public RequestProcessingManager(ITracer tracer, IPqlEngineHostProcess process, RawDataWriterPerfCounters counters)
        {
            if (tracer == null)
            {
                throw new ArgumentNullException("tracer");
            }

            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            if (counters == null)
            {
                throw new ArgumentNullException("counters");
            }

            m_counters = counters;
            m_executionContext = new RequestExecutionContext(process, tracer);
        }
        public RequestProcessingManager(ITracer tracer, IPqlEngineHostProcess process, RawDataWriterPerfCounters counters)
        {
            if (tracer == null)
            {
                throw new ArgumentNullException("tracer");
            }

            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            if (counters == null)
            {
                throw new ArgumentNullException("counters");
            }

            m_counters         = counters;
            m_executionContext = new RequestExecutionContext(process, tracer);
        }