示例#1
0
        /// <summary>
        /// Checks the context pool for a processor first. If none is available, creates a new one
        /// </summary>
        internal QueryProcessor CreateProcessor()
        {
            QueryProcessor p = null;

            lock (this.processorPool)
            {
                QueryProcessorPool pool = this.processorPool.Target as QueryProcessorPool;
                if (null != pool)
                {
                    p = pool.Pop();
                }
            }

            if (null != p)
            {
                p.ClearProcessor();
            }
            else
            {
                p = new QueryProcessor(this);
            }

            p.AddRef();
            return(p);
        }
        internal QueryProcessor CreateProcessor()
        {
            QueryProcessor processor = null;

            lock (this.processorPool)
            {
                QueryProcessorPool target = this.processorPool.Target as QueryProcessorPool;
                if (target != null)
                {
                    processor = target.Pop();
                }
            }
            if (processor != null)
            {
                processor.ClearProcessor();
            }
            else
            {
                processor = new QueryProcessor(this);
            }
            processor.AddRef();
            return(processor);
        }