public CallbackResponse cursorReady()

in cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/v2/ReactiveResultSetCallback.java [62:92]


  public CallbackResponse cursorReady(AsyncResultSet resultSet) {

    try {
      synchronized (this) {
        if (this.sink.requestedFromDownstream() < 1) {

          // TODO: when googleapis/java-spanner#1192 is released, remove the nested condition,
          // and return PAUSE regardless of previous state of this.paused. Validate TCK.
          if (!this.paused) {
            this.paused = true;
            return CallbackResponse.PAUSE;
          }
        }
      }

      switch (resultSet.tryNext()) {
        case DONE:
          this.sink.complete();
          return CallbackResponse.DONE;
        case OK:
          this.sink.next(new SpannerClientLibraryRow(resultSet.getCurrentRowAsStruct()));
          return CallbackResponse.CONTINUE;
        default:
          // ResultSet returning NOT_READY or null.
          return CallbackResponse.CONTINUE;
      }
    } catch (Exception t) {
      this.sink.error(t);
      return CallbackResponse.DONE;
    }
  }