Package io.deephaven.web.client.api
Interface Callbacks
public interface Callbacks
A set of utilities for creating callbacks and promises using lambdas.
-
Nested Class Summary
Nested Classes -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <S,F> void failLog(HasEventHandling failHandler, Consumer<S> from, F failure) static <S> elemental2.promise.Promise<S> grpcUnaryPromise(Consumer<io.grpc.stub.StreamObserver<S>> t) Returns a promise that resolves when the first payload arrives from a unary request.static <S> elemental2.promise.Promise<Callbacks.Response<S>> grpcUnaryPromiseWrapped(Consumer<io.grpc.stub.StreamObserver<S>> t) Propagates the message and the context into a Promise, as a promise's microtask will result in losing the context.static <T> io.grpc.stub.StreamObserver<T> ignore()static <S> elemental2.promise.Promise.PromiseExecutorCallbackFn.RejectCallbackFnnotNull(HasEventHandling failHandler, Consumer<S> realCallback, elemental2.promise.Promise.PromiseExecutorCallbackFn.RejectCallbackFn reject) static <S,F> Callback <S, F> of(BiConsumer<S, F> from) Transform a bi-consumer into a callback.static <S,T> elemental2.promise.Promise <S> promise(HasEventHandling failHandler, Consumer<Callback<S, T>> t)
-
Method Details
-
ignore
static <T> io.grpc.stub.StreamObserver<T> ignore() -
promise
static <S,T> elemental2.promise.Promise<S> promise(@Nullable HasEventHandling failHandler, Consumer<Callback<S, T>> t) -
notNull
static <S> elemental2.promise.Promise.PromiseExecutorCallbackFn.RejectCallbackFn notNull(@Nullable HasEventHandling failHandler, Consumer<S> realCallback, elemental2.promise.Promise.PromiseExecutorCallbackFn.RejectCallbackFn reject) -
failLog
-
of
Transform a bi-consumer into a callback. It is the caller's responsibility to fire "requestfailed" events as appropriate. -
grpcUnaryPromiseWrapped
static <S> elemental2.promise.Promise<Callbacks.Response<S>> grpcUnaryPromiseWrapped(Consumer<io.grpc.stub.StreamObserver<S>> t) Propagates the message and the context into a Promise, as a promise's microtask will result in losing the context. Does not resolve until the unary stream is closed, in order to read the trailers, in contrast withgrpcUnaryPromise(Consumer). -
grpcUnaryPromise
static <S> elemental2.promise.Promise<S> grpcUnaryPromise(Consumer<io.grpc.stub.StreamObserver<S>> t) Returns a promise that resolves when the first payload arrives from a unary request. Because promises resolve on a microtask, the later called promise will not necessarily share the same Context as the call, usegrpcUnaryPromiseWrapped(Consumer)for that.
-