Package com.github.phantomthief.scope
Class ScopeUtils
java.lang.Object
com.github.phantomthief.scope.ScopeUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.util.concurrent.ListenableFuture<?> runAsyncWithCurrentScope(Runnable runnable, com.google.common.util.concurrent.ListeningExecutorService executor) static voidrunAsyncWithCurrentScope(Runnable runnable, Executor executor) static <U> com.google.common.util.concurrent.ListenableFuture<U> supplyAsyncWithCurrentScope(Supplier<U> supplier, com.google.common.util.concurrent.ListeningExecutorService executor) static <U> Future<U> supplyAsyncWithCurrentScope(Supplier<U> supplier, ExecutorService executor) static LongCostTracktrackLongCost(Duration timeoutForReport, Consumer<Duration> onTimeoutReportRunnable) static <U> com.google.common.util.concurrent.FutureCallback<U> wrapWithScope(com.google.common.util.concurrent.FutureCallback<U> futureCallback) forFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
-
Method Details
-
runAsyncWithCurrentScope
-
runAsyncWithCurrentScope
-
supplyAsyncWithCurrentScope
-
supplyAsyncWithCurrentScope
-
trackLongCost
public static LongCostTrack trackLongCost(Duration timeoutForReport, Consumer<Duration> onTimeoutReportRunnable) - Parameters:
onTimeoutReportRunnable- accept a time duration in nano-seconds.
-
wrapWithScope
@Nonnull public static <U> com.google.common.util.concurrent.FutureCallback<U> wrapWithScope(@Nonnull com.google.common.util.concurrent.FutureCallback<U> futureCallback) forFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
-