public interface Batcher<T> extends Closeable
BatcherBuilder to generate a configured Batcher.
Batchers utilize a queue to buffer items while batches are being constructed. When a buffer size if provided, callers
can be prevented from overwhelming the queue with data. Use the appropriate add method to manage a full
queue.
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T item)
Adds a new item to be batched.
|
boolean |
add(T item,
long timeout,
TimeUnit unit)
Adds a new item to be batched.
|
boolean |
addOrWait(T item)
Adds a new item to be batched.
|
void |
close()
Closes the underlying batcher.
|
List<T> |
closeAndFlush()
Closes the underlying batcher and flushes the remaining elements in the queue to a list.
|
boolean add(T item)
boolean add(T item, long timeout, TimeUnit unit) throws InterruptedException
InterruptedExceptionboolean addOrWait(T item) throws InterruptedException
InterruptedExceptionList<T> closeAndFlush()
void close()
close in interface AutoCloseableclose in interface CloseableCopyright © 2018 Calrissian. All rights reserved.