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); }
internal void ReturnMessageWriter(MtomMessageEncoder.MtomBufferedMessageWriter messageWriter) { _bufferedWriterPool.Return(messageWriter); }