@ThreadSafe
public final class BufferingStreamObserver<T>
extends java.lang.Object
implements io.grpc.stub.StreamObserver<T>
StreamObserver
which uses a bounded queue to pass elements to a processing
thread responsible for interacting with the underlying CallStreamObserver
.
Flow control with the underlying CallStreamObserver
is handled with a Phaser
which waits for advancement of the phase if the CallStreamObserver
is not ready. Callers
are expected to advance the Phaser
whenever the underlying CallStreamObserver
becomes ready.
Constructor and Description |
---|
BufferingStreamObserver(java.util.concurrent.Phaser phaser,
io.grpc.stub.CallStreamObserver<T> outboundObserver,
java.util.concurrent.ExecutorService executor,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
int |
getBufferSize() |
void |
onCompleted() |
void |
onError(java.lang.Throwable t) |
void |
onNext(T value) |
public BufferingStreamObserver(java.util.concurrent.Phaser phaser, io.grpc.stub.CallStreamObserver<T> outboundObserver, java.util.concurrent.ExecutorService executor, int bufferSize)