Class Callables
- java.lang.Object
-
- com.google.common.util.concurrent.Callables
-
@GwtCompatible(emulated=true) public final class Callables extends java.lang.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 extends @Nullable java.lang.Object>
AsyncCallable<T>asAsyncCallable(java.util.concurrent.Callable<T> callable, ListeningExecutorService listeningExecutorService)
Creates anAsyncCallable
from aCallable
.static <T extends @Nullable java.lang.Object>
java.util.concurrent.Callable<T>returning(T value)
Creates aCallable
which immediately returns a preset value each time it is called.
-
-
-
Method Detail
-
returning
public static <T extends @Nullable java.lang.Object> java.util.concurrent.Callable<T> returning(T value)
Creates aCallable
which immediately returns a preset value each time it is called.
-
asAsyncCallable
@GwtIncompatible public static <T extends @Nullable java.lang.Object> AsyncCallable<T> asAsyncCallable(java.util.concurrent.Callable<T> callable, ListeningExecutorService listeningExecutorService)
Creates anAsyncCallable
from aCallable
.The
AsyncCallable
returns theListenableFuture
resulting fromListeningExecutorService.submit(Callable)
.- Since:
- 20.0
-
-