Class Callables
- java.lang.Object
-
- com.google.common.util.concurrent.Callables
-
@GwtCompatible(emulated=true) public final class Callables extends Object
Static utility methods pertaining to theCallable
interface.- Since:
- 1.0
- Author:
- Isaac Shum
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> AsyncCallable<T>
asAsyncCallable(Callable<T> callable, ListeningExecutorService listeningExecutorService)
Creates anAsyncCallable
from aCallable
.static <T> Callable<T>
returning(T value)
Creates aCallable
which immediately returns a preset value each time it is called.
-
-
-
Method Detail
-
returning
public static <T> Callable<T> returning(@NullableDecl T value)
Creates aCallable
which immediately returns a preset value each time it is called.
-
asAsyncCallable
@Beta @GwtIncompatible public static <T> AsyncCallable<T> asAsyncCallable(Callable<T> callable, ListeningExecutorService listeningExecutorService)
Creates anAsyncCallable
from aCallable
.The
AsyncCallable
returns theListenableFuture
resulting fromListeningExecutorService.submit(Callable)
.- Since:
- 20.0
-
-