Here you can find the source of getOrThrow(final ListenableFuture
private static <T> T getOrThrow(final ListenableFuture<T> Future, final Duration timeout)
//package com.java2s; //License from project: Apache License import com.google.common.base.Throwables; import com.google.common.util.concurrent.ListenableFuture; import java.time.Duration; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; public class Main { private static <T> T getOrThrow(final ListenableFuture<T> Future, final Duration timeout) { try {/*from ww w. j a v a 2s.c o m*/ return Future.get(timeout.toMillis(), TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw Throwables.propagate(e); } } }