/* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain. Use, modify, and * redistribute this code in any way without acknowledgement. */ package java.util.concurrent; /** * A task that returns a result and may throw an exception. * Implementors define a single method with no arguments called * call. * *

The Callable interface is similar to {@link Runnable}, * in that both are designed for classes whose instances are * potentially executed by another thread. A Runnable, * however, does not return a result and cannot throw a checked * exception. * * @since 1.5 * @see Executor * @see FutureTask * * @spec JSR-166 * @revised $Date: 2003/06/24 14:34:47 $ * @editor $Author: dl $ * @author Doug Lea */ public interface Callable { /** * Computes a result, or throws an exception if unable to do so. * * @return computed result * @throws Exception if unable to compute a result */ V call() throws Exception; }