Class Per<T>

Type Parameters:
T - the value type.
All Implemented Interfaces:
Flow.Processor<T,List<T>>, Flow.Publisher<List<T>>, Flow.Subscriber<T>

public class Per<T> extends Buffered<T,List<T>>
Buffers a number of values. It always requests the number of values from the publisher that equals the buffer size. It emits the buffered values as a list. This processor uses a shared thread.
Since:
2.0
Author:
Werner Donné
  • Constructor Details

    • Per

      public Per(int size)
      Create a buffer of size. The requestTimeout is set to 0.
      Parameters:
      size - the buffer size, which must be larger than zero.
    • Per

      public Per(int size, Duration timeout)
      Create a buffer of size with a timeout. The requestTimeout is set to 0.
      Parameters:
      size - the buffer size, which must be larger than zero.
      timeout - the timeout after which the buffer is flushed. It should be positive.
    • Per

      public Per(int size, Duration timeout, Duration requestTimeout)
      Create a buffer of size with a timeout.
      Parameters:
      size - the buffer size, which must be larger than zero.
      timeout - the timeout after which the buffer is flushed. It should be positive.
      requestTimeout - the time after which an additional element is requested, even if the upstream publisher hasn't sent all requested elements yet. This provides the opportunity to the publisher to complete properly when it has fewer elements left than the buffer size. It may be null.
      Since:
      3.0.2
  • Method Details