1 |
/* |
2 |
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
* Expert Group and released to the public domain. Use, modify, and |
4 |
* redistribute this code in any way without acknowledgement. |
5 |
*/ |
6 |
|
7 |
package java.util.concurrent; |
8 |
|
9 |
/** |
10 |
* A task that returns a result and may throw an exception. |
11 |
* Implementors define a single method with no arguments called |
12 |
* <tt>call</tt>. |
13 |
* |
14 |
* <p>The <tt>Callable</tt> interface is similar to {@link Runnable}, |
15 |
* in that both are designed for classes whose instances are |
16 |
* potentially executed by another thread. A <tt>Runnable</tt>, |
17 |
* however, does not return a result and cannot throw a checked |
18 |
* exception. |
19 |
* |
20 |
|
21 |
* @since 1.5 |
22 |
* @see Executor |
23 |
* @see FutureTask |
24 |
* |
25 |
* @spec JSR-166 |
26 |
* @revised $Date: 2003/06/23 02:26:16 $ |
27 |
* @editor $Author: brian $ |
28 |
* @author Doug Lea |
29 |
*/ |
30 |
public interface Callable<V> { |
31 |
/** |
32 |
* Computes a result, or throws an exception if unable to do so. |
33 |
* |
34 |
* @return computed result |
35 |
* @throws Exception if unable to compute a result |
36 |
*/ |
37 |
V call() throws Exception; |
38 |
} |