@CanIgnoreReturnValue
  static <V, X extends Exception> V getChecked(
      Future<V> future, Class<X> exceptionClass, long timeout, TimeUnit unit) throws X {
    // TODO(cpovirk): benchmark a version of this method that accepts a GetCheckedTypeValidator
    bestGetCheckedTypeValidator().validateClass(exceptionClass);
    try {
      return future.get(timeout, unit);
    } catch (InterruptedException e) {
      currentThread().interrupt();
      throw newWithCause(exceptionClass, e);
    } catch (TimeoutException e) {
      throw newWithCause(exceptionClass, e);
    } catch (ExecutionException e) {
      wrapAndThrowExceptionOrError(e.getCause(), exceptionClass);
      throw new AssertionError();
    }
  }
@CanIgnoreReturnValue
  static <V, X extends Exception> V getChecked(
      Future<V> future, Class<X> exceptionClass, long timeout, TimeUnit unit) throws X {
    
    bestGetCheckedTypeValidator().validateClass(exceptionClass);
    try {
      return future.get(timeout, unit);
    } catch (InterruptedException e) {
      currentThread().interrupt();
      throw newWithCause(exceptionClass, e);
    } catch (TimeoutException e) {
      throw newWithCause(exceptionClass, e);
    } catch (ExecutionException e) {
      wrapAndThrowExceptionOrError(e.getCause(), exceptionClass);
      throw new AssertionError();
    }
  }
@ CanIgnoreReturnValue static < V , X extends Exception > V getChecked ( Future < V > future , Class < X > exceptionClass , long timeout , TimeUnit unit ) throws X { // TODO(cpovirk): benchmark a version of this method that accepts a GetCheckedTypeValidator bestGetCheckedTypeValidator ( ) . validateClass ( exceptionClass ) ; try { return future . get ( timeout , unit ) ; } catch ( InterruptedException e ) { currentThread ( ) . interrupt ( ) ; throw newWithCause ( exceptionClass , e ) ; } catch ( TimeoutException e ) { throw newWithCause ( exceptionClass , e ) ; } catch ( ExecutionException e ) { wrapAndThrowExceptionOrError ( e . getCause ( ) , exceptionClass ) ; throw new AssertionError ( ) ; } }
Implementation of {@link Futures#getChecked(Future, Class, long, TimeUnit)}.
Implementation of {