Name
Callable<V>
Synopsis
This interface is a generalized form of the
java.lang.Runnable
interface. Unlike the
run( )
method of Runnable
, the
call( )
method of Callable
can
return a value and throw an Exception
.
Callable
is a generic type, and the type variable
V
represents the return type of the
call( )
method.
An ExecutorService
accepts
Callable
objects for asynchronous execution and
returns a Future
object representing the future
result of the call( )
method.
public interface Callable<V> { // Public Instance Methods V call( ) throws Exception; }
Passed To
AbstractExecutorService.submit( )
,
CompletionService.submit( )
,
ExecutorCompletionService.submit( )
,
Executors.{privilegedCallable( )
,
privilegedCallableUsingCurrentClassLoader( )}
,
ExecutorService.submit( )
,
FutureTask.FutureTask( )
,
ScheduledExecutorService.schedule( )
,
ScheduledThreadPoolExecutor.{schedule( )
,
submit( )}
Returned By
Executors.{callable( )
,
privilegedCallable( )
,
privilegedCallableUsingCurrentClassLoader( )}
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.