Example #1
0
        /// <summary>
        /// 添加一个产品皮缓存池队尾。
        /// </summary>
        /// <param name="product"></param>
        public void AddTail(TProduct product)
        {
            // 检查是否打开
            if (!this.IsOpen)
            {
                return;
            }

            if (this.Count >= this.Capacity)
            {
                throw new ApplicationException("产品缓冲池已满");
            }

            // Enqueue
            lock (_productQueue.SyncRoot)
            {
                _productQueue.Add(product);

                if (!this.DelayNotify)
                {
                    _cacheSemaphore.Release();
                }
            }
        }