public class BatchedInsertCountingCallback extends Object implements Callback<Reply>
BatchedWriteCallback
. This callback can be used as the callback for a
series of individual writes and will coalesce the results into a single
result based on a an expected number of callbacks.
The class does not track the input n
value and instead always returns
an N value based on the expected count. That limits the utility of this class
to inserts.
Constructor and Description |
---|
BatchedInsertCountingCallback(Callback<Reply> forwardCallback,
int expectedCount)
Creates a new CountingCallback.
|
public BatchedInsertCountingCallback(Callback<Reply> forwardCallback, int expectedCount)
forwardCallback
- The callback to notify with the final results once we receive
them all.expectedCount
- The expected number of callbacks.public void callback(Reply result)
Overridden to increment the count and when the max is reached forward the final results.
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.