Search in sources :

Example 1 with ListenableFuture

use of org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListenableFuture in project hbase by apache.

the class RegionHDFSBlockLocationFinder method refreshAndWait.

void refreshAndWait(Collection<RegionInfo> hris) {
    ArrayList<ListenableFuture<HDFSBlocksDistribution>> regionLocationFutures = new ArrayList<>(hris.size());
    for (RegionInfo hregionInfo : hris) {
        regionLocationFutures.add(asyncGetBlockDistribution(hregionInfo));
    }
    int index = 0;
    for (RegionInfo hregionInfo : hris) {
        ListenableFuture<HDFSBlocksDistribution> future = regionLocationFutures.get(index);
        try {
            cache.put(hregionInfo, future.get());
        } catch (InterruptedException ite) {
            Thread.currentThread().interrupt();
        } catch (ExecutionException ee) {
            LOG.debug("ExecutionException during HDFSBlocksDistribution computation for region = {}", hregionInfo.getEncodedName(), ee);
        }
        index++;
    }
}
Also used : ArrayList(java.util.ArrayList) ListenableFuture(org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListenableFuture) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) ExecutionException(java.util.concurrent.ExecutionException) HDFSBlocksDistribution(org.apache.hadoop.hbase.HDFSBlocksDistribution)

Aggregations

ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 HDFSBlocksDistribution (org.apache.hadoop.hbase.HDFSBlocksDistribution)1 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)1 ListenableFuture (org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListenableFuture)1