public class NameableCompletableFuture
extends java.lang.Object
| Constructor and Description |
|---|
NameableCompletableFuture() |
| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.concurrent.CompletableFuture<T> |
completedFutureNamed(java.lang.String name,
T value)
Named version of
CompletableFuture.completedFuture(value). |
static java.lang.String |
currentName()
Get the current CompletableFuture / completion name.
|
static <T> java.util.concurrent.CompletableFuture<T> |
disableContext(java.util.concurrent.CompletableFuture<T> future)
Disable any Cinnamon attached context on the given
CompletableFuture. |
static <T> java.util.concurrent.CompletableFuture<T> |
newNamed(java.lang.String name)
Named version of
new CompletableFuture<T>. |
static java.util.concurrent.CompletableFuture<java.lang.Void> |
runAsyncNamed(java.lang.String name,
java.lang.Runnable runnable)
Named version of
CompletableFuture.runAsync(runnable). |
static java.util.concurrent.CompletableFuture<java.lang.Void> |
runAsyncNamed(java.lang.String name,
java.lang.Runnable runnable,
java.util.concurrent.Executor executor)
Named version of
CompletableFuture.runAsync(runnable, executor). |
static <T> java.util.concurrent.CompletableFuture<T> |
supplyAsyncNamed(java.lang.String name,
java.util.function.Supplier<T> supplier)
Named version of
CompletableFuture.supplyAsync(supplier). |
static <T> java.util.concurrent.CompletableFuture<T> |
supplyAsyncNamed(java.lang.String name,
java.util.function.Supplier<T> supplier,
java.util.concurrent.Executor executor)
Named version of
CompletableFuture.supplyAsync(supplier, executor). |
static <F> F |
withName(java.lang.String name,
java.util.function.Supplier<F> f)
Add a name around CompletableFuture creation or completion callbacks.
|
public static java.lang.String currentName()
public static <F> F withName(java.lang.String name,
java.util.function.Supplier<F> f)
F - the return type of the supplied blockname - the name for the CompletableFuture and/or completion callbackf - the supplied block to name (with newly created CompletableFutures)public static <T> java.util.concurrent.CompletableFuture<T> newNamed(java.lang.String name)
new CompletableFuture<T>.T - the CompletableFuture's typename - the name for the CompletableFuturepublic static <T> java.util.concurrent.CompletableFuture<T> supplyAsyncNamed(java.lang.String name,
java.util.function.Supplier<T> supplier)
CompletableFuture.supplyAsync(supplier).T - the function's return typename - the name for the CompletableFuturesupplier - the supplier for CompletableFuture.supplyAsyncpublic static <T> java.util.concurrent.CompletableFuture<T> supplyAsyncNamed(java.lang.String name,
java.util.function.Supplier<T> supplier,
java.util.concurrent.Executor executor)
CompletableFuture.supplyAsync(supplier, executor).T - the function's return typename - the name for the CompletableFuturesupplier - the supplier for CompletableFuture.supplyAsyncexecutor - the executor to use for asynchronous executionpublic static java.util.concurrent.CompletableFuture<java.lang.Void> runAsyncNamed(java.lang.String name,
java.lang.Runnable runnable)
CompletableFuture.runAsync(runnable).name - the name for the CompletableFuturerunnable - the runnable for CompletableFuture.runAsyncpublic static java.util.concurrent.CompletableFuture<java.lang.Void> runAsyncNamed(java.lang.String name,
java.lang.Runnable runnable,
java.util.concurrent.Executor executor)
CompletableFuture.runAsync(runnable, executor).name - the name for the CompletableFuturerunnable - the runnable for CompletableFuture.runAsyncexecutor - the executor to use for asynchronous executionpublic static <T> java.util.concurrent.CompletableFuture<T> completedFutureNamed(java.lang.String name,
T value)
CompletableFuture.completedFuture(value).T - the type of the valuename - the name for the CompletableFuturevalue - the value for CompletableFuture.completedFuturepublic static <T> java.util.concurrent.CompletableFuture<T> disableContext(java.util.concurrent.CompletableFuture<T> future)
CompletableFuture.
Can be used if the CompletableFuture will be cached.
T - the type of the valuefuture - the CompletableFuture to disable contexts forCinnamon API. Copyright (c) 2015–2021 Lightbend.