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 the ThresholdBatchReceiver.
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-03 UTC."],[[["\u003cp\u003eThis webpage provides documentation for the \u003ccode\u003eThresholdBatcher\u003c/code\u003e class in the Google API Client Library for Java (GAX), detailing its functionality and usage across multiple versions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eThresholdBatcher\u003c/code\u003e class is designed to queue elements and deliver them in batches to a consumer when a time duration has passed or a threshold is reached, and it inherits members from the \u003ccode\u003ejava.lang.Object\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eThresholdBatcher\u003c/code\u003e is 2.63.1, and the page lists the documentation for many previous versions down to version 2.7.1.\u003c/p\u003e\n"],["\u003cp\u003eYou can use the \u003ccode\u003enewBuilder()\u003c/code\u003e static method to create a new \u003ccode\u003eThresholdBatcher\u003c/code\u003e, allowing you to add elements via the \u003ccode\u003eadd(E e)\u003c/code\u003e method, or to manually send the batch using \u003ccode\u003epushCurrentBatch()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAdding elements through the \u003ccode\u003eadd(E e)\u003c/code\u003e method can result in a \u003ccode\u003eFlowControlException\u003c/code\u003e if the thresholds are breached, leading to the batch being sent to the \u003ccode\u003eThresholdBatchReceiver\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,[]]