ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/Callable.java
Revision: 1.9
Committed: Tue Mar 15 19:47:03 2011 UTC (13 years, 2 months ago) by jsr166
Branch: MAIN
CVS Tags: release-1_7_0
Changes since 1.8: +1 -1 lines
Log Message:
Update Creative Commons license URL in legal notices

File Contents

# Content
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 * 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
15 * java.lang.Runnable}, in that both are designed for classes whose
16 * instances are potentially executed by another thread. A
17 * <tt>Runnable</tt>, however, does not return a result and cannot
18 * throw a checked exception.
19 *
20 * <p> The {@link Executors} class contains utility methods to
21 * convert from other common forms to <tt>Callable</tt> classes.
22 *
23 * @see Executor
24 * @since 1.5
25 * @author Doug Lea
26 * @param <V> the result type of method <tt>call</tt>
27 */
28 public interface Callable<V> {
29 /**
30 * Computes a result, or throws an exception if unable to do so.
31 *
32 * @return computed result
33 * @throws Exception if unable to compute a result
34 */
35 V call() throws Exception;
36 }