Class FutureStreamObserver<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- io.axoniq.axonserver.connector.impl.FutureStreamObserver<T>
-
- Type Parameters:
T- the type of result thisCompletableFutureandStreamObserverresolves
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<T>,CompletionStage<T>,Future<T>
public class FutureStreamObserver<T> extends CompletableFuture<T> implements io.grpc.stub.StreamObserver<T>
An implementation of both aCompletableFutureandStreamObserver. This future will complete successfully ononNext(Object)or ononCompleted()(granted that the givenvalueWhenNoResultis not of typeThrowable). OnonError(Throwable), this future willCompletableFuture.completeExceptionally(Throwable).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
-
Constructor Summary
Constructors Constructor Description FutureStreamObserver(Throwable valueWhenNoResult)Construct aFutureStreamObserver, using the givenvalueWhenNoResultif no result is returned.FutureStreamObserver(T valueWhenNoResult)Construct aFutureStreamObserver, using the givenvalueWhenNoResultif no result is returned.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonCompleted()voidonError(Throwable t)voidonNext(T value)-
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
-
-
-
-
Constructor Detail
-
FutureStreamObserver
public FutureStreamObserver(T valueWhenNoResult)
Construct aFutureStreamObserver, using the givenvalueWhenNoResultif no result is returned.- Parameters:
valueWhenNoResult- the object of typeTto return if nothing is returned by thisStreamObserver
-
FutureStreamObserver
public FutureStreamObserver(Throwable valueWhenNoResult)
Construct aFutureStreamObserver, using the givenvalueWhenNoResultif no result is returned. This future will complete exceptionally when thevalueWhenNoResultis used.- Parameters:
valueWhenNoResult- theThrowableto return if nothing is returned by thisStreamObserver
-
-
Method Detail
-
onNext
public void onNext(T value)
- Specified by:
onNextin interfaceio.grpc.stub.StreamObserver<T>
-
onError
public void onError(Throwable t)
- Specified by:
onErrorin interfaceio.grpc.stub.StreamObserver<T>
-
onCompleted
public void onCompleted()
- Specified by:
onCompletedin interfaceio.grpc.stub.StreamObserver<T>
-
-