1 /*
2  * Written by Doug Lea with assistance from members of JCP JSR-166
3  * Expert Group and released to the public domain, as explained at
4  * http://creativecommons.org/publicdomain/zero/1.0/
5  */
6 
7 package java.util.concurrent;
8 
9 /**
10  * Exception thrown when an error or other exception is encountered
11  * in the course of completing a result or task.
12  *
13  * @since 1.8
14  * @author Doug Lea
15  */
16 public class CompletionException extends RuntimeException {
17     private static final long serialVersionUID = 7830266012832686185L;
18 
19     /**
20      * Constructs a {@code CompletionException} with no detail message.
21      * The cause is not initialized, and may subsequently be
22      * initialized by a call to {@link #initCause(Throwable) initCause}.
23      */
CompletionException()24     protected CompletionException() { }
25 
26     /**
27      * Constructs a {@code CompletionException} with the specified detail
28      * message. The cause is not initialized, and may subsequently be
29      * initialized by a call to {@link #initCause(Throwable) initCause}.
30      *
31      * @param message the detail message
32      */
CompletionException(String message)33     protected CompletionException(String message) {
34         super(message);
35     }
36 
37     /**
38      * Constructs a {@code CompletionException} with the specified detail
39      * message and cause.
40      *
41      * @param  message the detail message
42      * @param  cause the cause (which is saved for later retrieval by the
43      *         {@link #getCause()} method)
44      */
CompletionException(String message, Throwable cause)45     public CompletionException(String message, Throwable cause) {
46         super(message, cause);
47     }
48 
49     /**
50      * Constructs a {@code CompletionException} with the specified cause.
51      * The detail message is set to {@code (cause == null ? null :
52      * cause.toString())} (which typically contains the class and
53      * detail message of {@code cause}).
54      *
55      * @param  cause the cause (which is saved for later retrieval by the
56      *         {@link #getCause()} method)
57      */
CompletionException(Throwable cause)58     public CompletionException(Throwable cause) {
59         super(cause);
60     }
61 }
62