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 voidblockingInvocation(Completable source) Subscribes aCompletableimmediately and awaits result.static <T> TblockingInvocation(Single<T> source) Subscribes aSingleimmediately and awaits result.static <T> TfutureGetCancelOnInterrupt(Future<T> future) Completes aFutureby invokingFuture.get().
-
Method Details
-
futureGetCancelOnInterrupt
Completes aFutureby invokingFuture.get(). Any occurredExceptionwill be converted to unchecked, andExecutionExceptions will be unwrapped. Upon interruption, theFutureis 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 aSingleimmediately and awaits result. Any occurredExceptionwill be converted to unchecked, andExecutionExceptions will be unwrapped. -
blockingInvocation
Subscribes aCompletableimmediately and awaits result. Any occurredExceptionwill be converted to unchecked, andExecutionExceptions will be unwrapped.- Parameters:
source- TheCompletableto operate on.- Throws:
Exception- unchecked exceptions for any exception that occurs.
-