Class DirectStreamObserver<T>

java.lang.Object
org.apache.beam.sdk.fn.stream.DirectStreamObserver<T>
All Implemented Interfaces:
org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<T>

@ThreadSafe public final class DirectStreamObserver<T> extends Object implements org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<T>
A StreamObserver which uses synchronization on the underlying CallStreamObserver to provide thread safety.

Flow control with the underlying CallStreamObserver is handled with a Phaser which waits for advancement of the phase if the CallStreamObserver is not ready. Creator is expected to advance the Phaser whenever the underlying CallStreamObserver becomes ready. If the Phaser is terminated,

invalid @link
{@link DirectStreamObserver<T>.onNext(T)
} will no longer wait for the CallStreamObserver to become ready.
  • Constructor Details

    • DirectStreamObserver

      public DirectStreamObserver(Phaser phaser, org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.CallStreamObserver<T> outboundObserver)
  • Method Details

    • onNext

      public void onNext(T value)
      Specified by:
      onNext in interface org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<T>
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<T>
    • onCompleted

      public void onCompleted()
      Specified by:
      onCompleted in interface org.apache.beam.vendor.grpc.v1p69p0.io.grpc.stub.StreamObserver<T>