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.
Adds an element to the batcher. If the element causes the collection to go past any of the
thresholds, the batch will be sent to theThresholdBatchReceiver.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis webpage details the \u003ccode\u003eThresholdBatcher\u003c/code\u003e class, which is designed to queue elements until a time duration or a set threshold is met, subsequently delivering them as a batch.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eThresholdBatcher\u003c/code\u003e is 2.63.1, and the page contains a comprehensive list of previous versions ranging down to 2.7.1, all linking to their specific documentation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eThresholdBatcher\u003c/code\u003e inherits from \u003ccode\u003ejava.lang.Object\u003c/code\u003e and includes inherited methods such as \u003ccode\u003eclone()\u003c/code\u003e, \u003ccode\u003eequals(Object)\u003c/code\u003e, \u003ccode\u003egetClass()\u003c/code\u003e, and \u003ccode\u003ewait()\u003c/code\u003e, among others.\u003c/p\u003e\n"],["\u003cp\u003eA static method, \u003ccode\u003enewBuilder()\u003c/code\u003e, is provided to create a new builder for the \u003ccode\u003eThresholdBatcher\u003c/code\u003e, enabling customized configurations.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eadd(E e)\u003c/code\u003e method allows adding elements to the batcher, and it sends the batch to \u003ccode\u003eThresholdBatchReceiver\u003c/code\u003e if a threshold is breached, or a \u003ccode\u003eFlowControlException\u003c/code\u003e may be thrown.\u003c/p\u003e\n"]]],[],null,[]]