예제 #1
0
        private BinaryBufferedMessageWriter TakeBufferedWriter()
        {
            if (_bufferedWriterPool == null)
            {
                lock (ThisLock)
                {
                    if (_bufferedWriterPool == null)
                    {
                        //running = true;
                        _bufferedWriterPool = new SynchronizedPool<BinaryBufferedMessageWriter>(_maxWritePoolSize);
                    }
                }
            }

            BinaryBufferedMessageWriter messageWriter = _bufferedWriterPool.Take();
            if (messageWriter == null)
            {
                messageWriter = new BinaryBufferedMessageWriter(_binaryVersion.Dictionary);
                if (WcfEventSource.Instance.WritePoolMissIsEnabled())
                {
                    WcfEventSource.Instance.WritePoolMiss(messageWriter.GetType().Name);
                }
            }
            return messageWriter;
        }
        BinaryBufferedMessageWriter TakeBufferedWriter()
        {
            if (bufferedWriterPool == null)
            {
                lock (ThisLock)
                {
                    if (bufferedWriterPool == null)
                    {
                        //running = true;
                        bufferedWriterPool = new SynchronizedPool<BinaryBufferedMessageWriter>(maxWritePoolSize);
                    }
                }
            }

            BinaryBufferedMessageWriter messageWriter = bufferedWriterPool.Take();
            if (messageWriter == null)
            {
                messageWriter = new BinaryBufferedMessageWriter(binaryVersion.Dictionary);
                if (TD.WritePoolMissIsEnabled())
                {
                    TD.WritePoolMiss(messageWriter.GetType().Name);
                }
            }
            return messageWriter;
        }