@Beta public interface CardinalityEstimator extends DistributedObject
Modifier and Type | Method and Description |
---|---|
void |
add(Object obj)
Add a new object in the estimation set.
|
ICompletableFuture<Void> |
addAsync(Object obj)
Add a new object in the estimation set.
|
long |
estimate()
Estimates the cardinality of the aggregation so far.
|
ICompletableFuture<Long> |
estimateAsync()
Estimates the cardinality of the aggregation so far.
|
destroy, getName, getPartitionKey, getServiceName
void add(Object obj)
obj
- object to add in the estimation set.NullPointerException
- if obj is nulllong estimate()
ICompletableFuture<Void> addAsync(Object obj)
ICompletableFuture
.
The operations result can be obtained in a blocking way, or a
callback can be provided for execution upon completion, as demonstrated in the following examples:
ICompletableFuture<Void> future = estimator.addAsync(); // do something else, then read the result Boolean result = future.get(); // this method will block until the result is available
ICompletableFuture<Void> future = estimator.addAsync(); future.andThen(new ExecutionCallback<Void>() { void onResponse(Void response) { // do something } void onFailure(Throwable t) { // handle failure } });
obj
- object to add in the estimation set.ICompletableFuture
API consumers can use to track execution of this request.NullPointerException
- if obj is nullICompletableFuture<Long> estimateAsync()
ICompletableFuture
.
The operations result can be obtained in a blocking way, or a
callback can be provided for execution upon completion, as demonstrated in the following examples:
ICompletableFuture<Long> future = estimator.estimateAsync(); // do something else, then read the result Long result = future.get(); // this method will block until the result is available
ICompletableFuture<Long> future = estimator.estimateAsync(); future.andThen(new ExecutionCallback<Long>() { void onResponse(Long response) { // do something with the result } void onFailure(Throwable t) { // handle failure } });
ICompletableFuture
bearing the response, the estimate.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.