Package com.couchbase.client.core.api.kv
Class CoreAsyncResponse<T>
- java.lang.Object
-
- com.couchbase.client.core.api.kv.CoreAsyncResponse<T>
-
@Internal public final class CoreAsyncResponse<T> extends Object
Associates aCompletableFuture
with a cancellation task.Lets the Async API tell the Reactive API how to cancel a request in a protocol-agnostic way, so the default implementation of the Reactive API works with both Classic and Protostellar.
A CompletableFuture alone is not sufficient, because a completion stage does not propagate cancellation upstream. If the Async API methods were to return only a CompletableFuture, they could not reliably attach the cancellation logic required by the Reactive API methods (which by default are thin wrappers over the Async APIs).
-
-
Constructor Summary
Constructors Constructor Description CoreAsyncResponse(CompletableFuture<T> future, Runnable cancellationTask)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <U> CoreAsyncResponse<U>
map(Function<? super T,? extends U> fn)
<U> CompletableFuture<U>
thenApply(Function<? super T,? extends U> fn)
T
toBlocking()
CompletableFuture<T>
toFuture()
Mono<T>
toMono()
-
-
-
Constructor Detail
-
CoreAsyncResponse
public CoreAsyncResponse(CompletableFuture<T> future, Runnable cancellationTask)
-
-
Method Detail
-
toBlocking
public T toBlocking()
-
toFuture
public CompletableFuture<T> toFuture()
-
thenApply
public <U> CompletableFuture<U> thenApply(Function<? super T,? extends U> fn)
-
map
public <U> CoreAsyncResponse<U> map(Function<? super T,? extends U> fn)
-
-