Class ThresholdBatcher<E>


  • public final class ThresholdBatcher<E>
    extends java.lang.Object
    Queues up elements until either a duration of time has passed or any threshold in a given set of thresholds is breached, and then delivers the elements in a batch to the consumer.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ThresholdBatcher.Builder<E>
      Builder for a ThresholdBatcher.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(E e)
      Adds an element to the batcher.
      static <E> ThresholdBatcher.Builder<E> newBuilder()
      Get a new builder for a ThresholdBatcher.
      com.google.api.core.ApiFuture<java.lang.Void> pushCurrentBatch()
      Push the current batch to the batch receiver.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • pushCurrentBatch

        public com.google.api.core.ApiFuture<java.lang.Void> pushCurrentBatch()
        Push the current batch to the batch receiver. Returns an ApiFuture that completes once the batch has been processed by the batch receiver and the flow controller resources have been released.

        Note that this future can complete for the current batch before previous batches have completed, so it cannot be depended upon for flushing.