class AttributeMetadata {

    public Integer getCountOfDistinctKeys() {
        QueryOptions queryOptions = openResources();
        try {
            return index.getCountOfDistinctKeys(queryOptions);
        }
        finally {
            closeResources(queryOptions);
        }
    }

      AttributeMetadata(KeyStatisticsIndex<A, O> index, Supplier<QueryOptions> openResourcesHandler, Consumer<QueryOptions> closeResourcesHandler);

}