@ThreadSafe
public final class BufferingStreamObserver<T>
extends java.lang.Object
implements org.apache.beam.vendor.grpc.v1_13_1.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,
org.apache.beam.vendor.grpc.v1_13_1.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, org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.CallStreamObserver<T> outboundObserver, java.util.concurrent.ExecutorService executor, int bufferSize)
public void onNext(T value)
onNext
in interface org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.StreamObserver<T>
public void onError(java.lang.Throwable t)
onError
in interface org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.StreamObserver<T>
public void onCompleted()
onCompleted
in interface org.apache.beam.vendor.grpc.v1_13_1.io.grpc.stub.StreamObserver<T>
public int getBufferSize()