Example usage for com.google.common.cache LoadingCache getAll

List of usage examples for com.google.common.cache LoadingCache getAll

Introduction

In this page you can find the example usage for com.google.common.cache LoadingCache getAll.

Prototype

ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionException;

Source Link

Document

Returns a map of the values associated with keys , creating or retrieving those values if necessary.

Usage

From source file:com.facebook.presto.hive.CachingHiveMetastore.java

private static <K, V, E extends Exception> Map<K, V> getAll(LoadingCache<K, V> cache, Iterable<K> keys,
        Class<E> exceptionClass) throws E {
    try {//from w  ww  . ja v  a  2 s .c  om
        return cache.getAll(keys);
    } catch (ExecutionException | UncheckedExecutionException e) {
        Throwable t = e.getCause();
        Throwables.propagateIfInstanceOf(t, exceptionClass);
        throw Throwables.propagate(t);
    }
}

From source file:io.prestosql.plugin.hive.metastore.CachingHiveMetastore.java

private static <K, V> Map<K, V> getAll(LoadingCache<K, V> cache, Iterable<K> keys) {
    try {//from  w ww  .j a v a 2  s .  com
        return cache.getAll(keys);
    } catch (ExecutionException | UncheckedExecutionException e) {
        throwIfInstanceOf(e.getCause(), PrestoException.class);
        throwIfUnchecked(e);
        throw new UncheckedExecutionException(e);
    }
}

From source file:com.facebook.presto.hive.metastore.CachingHiveMetastore.java

private static <K, V> Map<K, V> getAll(LoadingCache<K, V> cache, Iterable<K> keys) {
    try {// w w  w. j a  va  2  s.c o  m
        return cache.getAll(keys);
    } catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw Throwables.propagate(e.getCause());
    }
}