Exemple #1
0
 public MtomBufferedMessageData(MtomMessageEncoder messageEncoder, int maxReaderPoolSize)
     : base(messageEncoder._factory.RecycledStatePool)
 {
     _messageEncoder = messageEncoder;
     _readerPool     = new Pool <XmlDictionaryReader>(maxReaderPoolSize);
     _onClose        = new OnXmlDictionaryReaderClose(OnXmlReaderClosed);
 }
Exemple #2
0
 internal MtomMessageEncoder.MtomBufferedMessageData TakeBufferedReader(MtomMessageEncoder messageEncoder)
 {
     if (_bufferedReaderPool == null)
     {
         lock (_thisLock)
         {
             if (_bufferedReaderPool == null)
             {
                 _bufferedReaderPool = new SynchronizedPool <MtomMessageEncoder.MtomBufferedMessageData>(MaxReadPoolSize);
             }
         }
     }
     MtomMessageEncoder.MtomBufferedMessageData messageData = _bufferedReaderPool.Take();
     if (messageData == null)
     {
         messageData = new MtomMessageEncoder.MtomBufferedMessageData(messageEncoder, MaxPooledXmlReadersPerMessage);
         // if (WcfEventSource.Instance.ReadPoolMissIsEnabled())
         // {
         //     WcfEventSource.Instance.ReadPoolMiss(messageData.GetType().Name);
         // }
     }
     return(messageData);
 }
Exemple #3
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);
        }
Exemple #4
0
 public MtomBufferedMessageWriter(MtomMessageEncoder messageEncoder)
 {
     _messageEncoder = messageEncoder;
 }