/// <inheritdoc />
 protected override void ReceiveWithSemaphoreHeld(IEnumerable <T> items)
 {
     GaxPreconditions.CheckNotNull(items, nameof(items));
     foreach (T item in items)
     {
         _size += _sizer.GetSize(item);
         _items.Add(item);
         if (_size >= _bufferSize)
         {
             FlushWithSemaphoreHeld();
         }
     }
 }
Esempio n. 2
0
 /// <inheritdoc />
 public void Receive(IEnumerable <T> items)
 {
     GaxPreconditions.CheckNotNull(items, nameof(items));
     lock (_mutex)
     {
         foreach (T item in items)
         {
             _size += _sizer.GetSize(item);
             _items.Add(item);
             if (_size >= _bufferSize)
             {
                 Flush();
             }
         }
     }
 }