11d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert/*
21d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Copyright (C) 2011 The Guava Authors
31d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert *
41d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Licensed under the Apache License, Version 2.0 (the "License");
51d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * you may not use this file except in compliance with the License.
61d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * You may obtain a copy of the License at
71d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert *
81d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * http://www.apache.org/licenses/LICENSE-2.0
91d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert *
101d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Unless required by applicable law or agreed to in writing, software
111d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * distributed under the License is distributed on an "AS IS" BASIS,
121d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * See the License for the specific language governing permissions and
141d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * limitations under the License.
151d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */
161d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
171d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertpackage com.google.common.util.concurrent;
181d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
191d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport com.google.common.annotations.Beta;
201d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport com.google.common.annotations.GwtCompatible;
211d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
221d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert/**
231d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Unchecked variant of {@link java.util.concurrent.ExecutionException}. As with
241d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * {@code ExecutionException}, the exception's {@linkplain #getCause() cause}
251d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * comes from a failed task, possibly run in another thread.
261d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert *
271d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * <p>{@code UncheckedExecutionException} is intended as an alternative to
281d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * {@code ExecutionException} when the exception thrown by a task is an
291d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * unchecked exception. This allows the client code to continue to distinguish
301d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * between checked and unchecked exceptions, even when they come from other
311d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * threads.
321d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert *
331d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * <p>When wrapping an {@code Error} from another thread, prefer {@link
341d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * ExecutionError}.
351d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert *
361d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * @author Charles Fry
371d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * @since 10.0
381d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */
391d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert@Beta
401d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert@GwtCompatible
411d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertpublic class UncheckedExecutionException extends RuntimeException {
421d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  /**
431d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   * Creates a new instance with {@code null} as its detail message.
441d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   */
451d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  protected UncheckedExecutionException() {}
461d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
471d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  /**
481d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   * Creates a new instance with the given detail message.
491d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   */
501d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  protected UncheckedExecutionException(String message) {
511d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert    super(message);
521d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  }
531d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
541d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  /**
551d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   * Creates a new instance with the given detail message and cause.
561d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   */
571d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  public UncheckedExecutionException(String message, Throwable cause) {
581d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert    super(message, cause);
591d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  }
601d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
611d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  /**
621d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   * Creates a new instance with the given cause.
631d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert   */
641d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  public UncheckedExecutionException(Throwable cause) {
651d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert    super(cause);
661d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  }
671d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
681d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  private static final long serialVersionUID = 0;
691d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert}
70