| ExecutionException.java |
1 /*
2 * %W% %E%
3 *
4 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6 */
7
8 package java.util.concurrent;
9
10 /**
11 * Exception thrown when attempting to retrieve the result of a task
12 * that aborted by throwing an exception. This exception can be
13 * inspected using the {@link #getCause()} method.
14 *
15 * @see Future
16 * @since 1.5
17 * @author Doug Lea
18 */
19 public class ExecutionException extends Exception {
20 private static final long serialVersionUID = 7830266012832686185L;
21
22 /**
23 * Constructs an <tt>ExecutionException</tt> with no detail message.
24 * The cause is not initialized, and may subsequently be
25 * initialized by a call to {@link #initCause(Throwable) initCause}.
26 */
27 protected ExecutionException() { }
28
29 /**
30 * Constructs an <tt>ExecutionException</tt> with the specified detail
31 * message. The cause is not initialized, and may subsequently be
32 * initialized by a call to {@link #initCause(Throwable) initCause}.
33 *
34 * @param message the detail message
35 */
36 protected ExecutionException(String message) {
37 super(message);
38 }
39
40 /**
41 * Constructs an <tt>ExecutionException</tt> with the specified detail
42 * message and cause.
43 *
44 * @param message the detail message
45 * @param cause the cause (which is saved for later retrieval by the
46 * {@link #getCause()} method)
47 */
48 public ExecutionException(String message, Throwable cause) {
49 super(message, cause);
50 }
51
52 /**
53 * Constructs an <tt>ExecutionException</tt> with the specified cause.
54 * The detail message is set to:
55 * <pre>
56 * (cause == null ? null : cause.toString())</pre>
57 * (which typically contains the class and detail message of
58 * <tt>cause</tt>).
59 *
60 * @param cause the cause (which is saved for later retrieval by the
61 * {@link #getCause()} method)
62 */
63 public ExecutionException(Throwable cause) {
64 super(cause);
65 }
66 }
67