K - Type of a KeyT - Type of a Valuepublic interface Batch<K,T>
| Modifier and Type | Method and Description |
|---|---|
int |
batchSize()
Returns size of this batch.
|
void |
done(K key,
T value)
Completes a
Promise associated with given key with
a value. |
Set<Map.Entry<K,BatchImpl.BatchEntry<T>>> |
entries() |
void |
fail(K key,
Throwable error)
Fails a
Promise associated with given key with
an error. |
int |
failAll(Throwable error)
Fails all promises belonging to this batch with given error.
|
void |
foreach(BiConsumer<K,com.linkedin.parseq.promise.SettablePromise<T>> consumer)
Performs the given action for each element of the batch
until all elements have been processed or the action throws an
exception.
|
Set<K> |
keys()
Returns set of keys belonging to this batch.
|
int |
keySize()
Returns number of keys belonging to this batch.
|
Collection<BatchImpl.BatchEntry<T>> |
values() |
void foreach(BiConsumer<K,com.linkedin.parseq.promise.SettablePromise<T>> consumer)
consumer - action to be performed in each element of the batchSet<K> keys()
int keySize()
int batchSize()
BatchingStrategy.keySize(Object, Object) is
defined.void done(K key, T value) throws com.linkedin.parseq.promise.PromiseResolvedException
Promise associated with given key with
a value.
Throws PromiseResolvedException if Promise associated with given key has already been resolved.key - key that identifies a Promise to be completedvalue - value to complete Promise withcom.linkedin.parseq.promise.PromiseResolvedException - if Promise associated with given key has already been resolvedvoid fail(K key, Throwable error) throws com.linkedin.parseq.promise.PromiseResolvedException
Promise associated with given key with
an error.
Throws PromiseResolvedException if Promise associated with given key has already been resolved.key - key that identifies a Promise to be completederror - error to fail Promise withcom.linkedin.parseq.promise.PromiseResolvedException - if Promise associated with given key has already been resolvedint failAll(Throwable error)
error - error that all promises belonging to this batch will be failed with0 it means that it successfully failed all promises belonging to this batch with
specified errorCollection<BatchImpl.BatchEntry<T>> values()
Set<Map.Entry<K,BatchImpl.BatchEntry<T>>> entries()
Copyright © 2018. All rights reserved.