Class BlockingUtils
java.lang.Object
io.servicetalk.concurrent.api.internal.BlockingUtils
Common utility functions to unwrap
ExecutionException
from async operations.-
Method Summary
Modifier and TypeMethodDescriptionstatic void
blockingInvocation
(Completable source) Subscribes aCompletable
immediately and awaits result.static <T> T
blockingInvocation
(Single<T> source) Subscribes aSingle
immediately and awaits result.static <T> T
futureGetCancelOnInterrupt
(Future<T> future) Completes aFuture
by invokingFuture.get()
.
-
Method Details
-
futureGetCancelOnInterrupt
Completes aFuture
by invokingFuture.get()
. Any occurredException
will be converted to unchecked, andExecutionException
s will be unwrapped. Upon interruption, theFuture
is cancelled.- Type Parameters:
T
- The type of the result.- Parameters:
future
- The future to operate on.- Returns:
- The result of the future.
- Throws:
Exception
- InterrupedException upon interruption or unchecked exceptions for any other exception.
-
blockingInvocation
Subscribes aSingle
immediately and awaits result. Any occurredException
will be converted to unchecked, andExecutionException
s will be unwrapped. -
blockingInvocation
Subscribes aCompletable
immediately and awaits result. Any occurredException
will be converted to unchecked, andExecutionException
s will be unwrapped.- Parameters:
source
- TheCompletable
to operate on.- Throws:
Exception
- unchecked exceptions for any exception that occurs.
-