Ejemplo n.º 1
0
        internal MtomMessageEncoder.MtomBufferedMessageWriter TakeBufferedWriter(MtomMessageEncoder messageEncoder)
        {
            if (_bufferedWriterPool == null)
            {
                lock (_thisLock)
                {
                    if (_bufferedWriterPool == null)
                    {
                        _bufferedWriterPool = new SynchronizedPool <MtomMessageEncoder.MtomBufferedMessageWriter>(MaxWritePoolSize);
                    }
                }
            }

            MtomMessageEncoder.MtomBufferedMessageWriter messageWriter = _bufferedWriterPool.Take();
            if (messageWriter == null)
            {
                messageWriter = new MtomMessageEncoder.MtomBufferedMessageWriter(messageEncoder);
                if (WcfEventSource.Instance.WritePoolMissIsEnabled())
                {
                    WcfEventSource.Instance.WritePoolMiss(messageWriter.GetType().Name);
                }
            }
            return(messageWriter);
        }
Ejemplo n.º 2
0
 internal void ReturnMessageWriter(MtomMessageEncoder.MtomBufferedMessageWriter messageWriter)
 {
     _bufferedWriterPool.Return(messageWriter);
 }