ResponseQueueReader (Cloud Bigtable HBase Client for Java 1.12.0 API)

com.google.cloud.bigtable.grpc.scanner

Class ResponseQueueReader

  • All Implemented Interfaces:
    io.grpc.stub.ClientResponseObserver<com.google.bigtable.v2.ReadRowsRequest,FlatRow>, io.grpc.stub.StreamObserver<FlatRow>


    public class ResponseQueueReader
    extends Object
    implements io.grpc.stub.StreamObserver<FlatRow>, io.grpc.stub.ClientResponseObserver<com.google.bigtable.v2.ReadRowsRequest,FlatRow>
    Manages a queue of ResultQueueEntrys of FlatRow.
    Version:
    $Id: $Id
    Author:
    sduskis
    See Also:
    for more information.
    • Constructor Detail

      • ResponseQueueReader

        public ResponseQueueReader()
        Constructor for ResponseQueueReader.
    • Method Detail

      • beforeStart

        public void beforeStart(io.grpc.stub.ClientCallStreamObserver<com.google.bigtable.v2.ReadRowsRequest> requestStream)
        Specified by:
        beforeStart in interface io.grpc.stub.ClientResponseObserver<com.google.bigtable.v2.ReadRowsRequest,FlatRow>
      • close

        public void close()
      • getNextMergedRow

        public FlatRow getNextMergedRow()
                                 throws IOException
        Get the next complete FlatRow object from the response queue.
        Returns:
        null if end-of-stream, otherwise a complete FlatRow.
        Throws:
        IOException - On errors.
      • getNext

        protected com.google.cloud.bigtable.grpc.scanner.ResultQueueEntry<FlatRow> getNext()
                                                                                    throws IOException
        getNext.
        Returns:
        a ResultQueueEntry object.
        Throws:
        IOException - if any.
      • available

        public int available()
        available.
        Returns:
        a int.
      • onNext

        public void onNext(FlatRow row)
        Specified by:
        onNext in interface io.grpc.stub.StreamObserver<FlatRow>
      • onError

        public void onError(Throwable t)
        Specified by:
        onError in interface io.grpc.stub.StreamObserver<FlatRow>
      • onCompleted

        public void onCompleted()
        Specified by:
        onCompleted in interface io.grpc.stub.StreamObserver<FlatRow>
      • addRequestResultMarker

        public void addRequestResultMarker()
        This marker notifies getNextMergedRow() to request more results and allows for flow control based on the state of the resultQueue. If rows are removed from the queue quickly, getNextMergedRow() will request more results. If rows are not read fast enough, then gRPC will stop fetching rows, and will wait until more rows are requested. This marker tells getNextMergedRow() to read more rows.