use of com.google.api.gax.rpc.StreamController in project java-bigquerystorage by googleapis.
the class ReadRowsAttemptCallable method onRequest.
/**
* Called when the outer {@link ResponseObserver} is ready for more data.
*
* @see StreamController#request(int)
*/
private void onRequest(int count) {
Preconditions.checkState(!autoFlowControl, "Automatic flow control is enabled");
Preconditions.checkArgument(count > 0, "Count must be > 0");
final StreamController localInnerController;
synchronized (lock) {
int maxInc = Integer.MAX_VALUE - pendingRequests;
count = Math.min(maxInc, count);
pendingRequests += count;
localInnerController = this.innerController;
}
// ignore it and the current controller will pick it up onStart.
if (localInnerController != null) {
localInnerController.request(count);
}
}
Aggregations