// to global cache, because it was in use
Iterator<Map.Entry<AggregationKey, Aggregation>>
it = pendingAggregations.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<AggregationKey, Aggregation> e = it.next();
AggregationKey aggregationKey = e.getKey();
Aggregation aggregation = e.getValue();
// In case this aggregation is not requested by anyone
// this aggregation may be pushed into global cache
// otherwise put it in pending cache, that will be pushed
// when another query finishes
if (!isAggregationRequested(aggregationKey)) {
pushAggregateModification(
aggregationKey, aggregation, sharedAggregations);
it.remove();
}
}
// Push thread local modifications
it = localAggregations.get().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<AggregationKey, Aggregation> e = it.next();
AggregationKey aggregationKey = e.getKey();
Aggregation aggregation = e.getValue();
// In case this aggregation is not requested by anyone
// this aggregation may be pushed into global cache
// otherwise put it in pending cache, that will be pushed
// when another query finishes