java.util.concurrent
Interface Callable<V>

Type Parameters:
V - the result type of method call

public interface Callable<V>

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 Runnable sample code for java.lang.Runnable definition code for java.lang.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.

The Executors sample code for java.util.concurrent.Executors definition code for java.util.concurrent.Executors class contains utility methods to convert from other common forms to Callable classes.

Since:
1.5
See Also:
Executor sample code for java.util.concurrent.Executor definition code for java.util.concurrent.Executor

Method Summary
 V call sample code for java.util.concurrent.Callable.call() definition code for java.util.concurrent.Callable.call() ()
          Computes a result, or throws an exception if unable to do so.
 

Method Detail

call sample code for java.util.concurrent.Callable.call() definition code for java.util.concurrent.Callable.call()

V call()
       throws Exception sample code for java.lang.Exception definition code for java.lang.Exception 
Computes a result, or throws an exception if unable to do so.

Returns:
computed result
Throws:
Exception sample code for java.lang.Exception definition code for java.lang.Exception - if unable to compute a result