示例#1
0
        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            var byteBuffer = message as IByteBuffer;

            try
            {
                if (byteBuffer != null)
                {
                    lockFreeQueue.EnQueue(byteBuffer);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("入无锁队列:" + ex.Message);
            }
            finally
            {
                // byteBuffer.Release();
                //byteBuffer.Retain();
                //ReferenceCountUtil.Release(message);//防止内存泄漏
                //if (byteBuffer.ReferenceCount > 0)
                //{
                //    byteBuffer.Release();
                //}
            }
        }