1 /* 2 * Copyright (C) 2018 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14 15 package com.google.common.util.concurrent.internal; 16 17 18 /** 19 * Static utilities for {@link InternalFutureFailureAccess}. Most users will never need to use this 20 * class. 21 * 22 * <p>This class is GWT-compatible. 23 * 24 * @since {@code com.google.guava:failureaccess:1.0}, which was added as a dependency of Guava in 25 * Guava 27.0 26 */ 27 public final class InternalFutures { 28 /** 29 * Usually returns {@code null} but, if the given {@code Future} has failed, may <i>optionally</i> 30 * return the cause of the failure. "Failure" means specifically "completed with an exception"; it 31 * does not include "was cancelled." To be explicit: If this method returns a non-null value, 32 * then: 33 * 34 * <ul> 35 * <li>{@code isDone()} must return {@code true} 36 * <li>{@code isCancelled()} must return {@code false} 37 * <li>{@code get()} must not block, and it must throw an {@code ExecutionException} with the 38 * return value of this method as its cause 39 * </ul> 40 */ 41 public static tryInternalFastPathGetFailure(InternalFutureFailureAccess future)42 Throwable tryInternalFastPathGetFailure(InternalFutureFailureAccess future) { 43 return future.tryInternalFastPathGetFailure(); 44 } 45 InternalFutures()46 private InternalFutures() {} 47 } 48