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( )}
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access