}
@Override
public long getTotalSize() {
long totalSize = 0;
EntryIterable entryIterator = null;
try {
entryIterator = cache.filterEntries(AllFilter.INSTANCE);
CloseableIterable ci = entryIterator.converter(NullConverter.INSTANCE);
Iterator iter = ci.iterator();
while (iter.hasNext()) {
iter.next();
totalSize++;
}
return totalSize;
} finally {
if (entryIterator != null) {
try {
entryIterator.close();
} catch (Exception e) {
log.error("Failed to close EntryIterable", e);
}
}
}