Microsoft.Azure.Amqp.InternalBufferManager.Create C# (CSharp) Method

Create() public static method

public static Create ( long maxBufferPoolSize, int maxBufferSize, bool isTransportBufferPool ) : InternalBufferManager
maxBufferPoolSize long
maxBufferSize int
isTransportBufferPool bool
return InternalBufferManager
        public static InternalBufferManager Create(long maxBufferPoolSize, int maxBufferSize, bool isTransportBufferPool)
        {
            if (maxBufferPoolSize == 0)
            {
                return GCBufferManager.Value;
            }
            else
            {
                Fx.Assert(maxBufferPoolSize > 0 && maxBufferSize >= 0, "bad params, caller should verify");
                if (isTransportBufferPool)
                {
                    return new PreallocatedBufferManager(maxBufferPoolSize, maxBufferSize);
                }
                else
                {
                    return new PooledBufferManager(maxBufferPoolSize, maxBufferSize);
                }
            }
        }

Usage Example

Example #1
0
 public static void InitBufferManagers()
 {
     if (TransportBufferManager == null)
     {
         lock (syncRoot)
         {
             if (TransportBufferManager == null)
             {
                 TransportBufferManager = InternalBufferManager.Create(48 * 1024 * 1024, AmqpConstants.TransportBufferSize, true);
             }
         }
     }
 }