public void run()

in jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamResultSet.java [288:336]


    public void run() {
      final QueryRequest request = new QueryRequest().withQueryString(query);

      if (fetchSize != 0) {
        request.withMaxRows(fetchSize);
      }

      while (!isInterrupted && nextToken != null) {
        try {
          final long startExecutionTime = System.nanoTime();
          final QueryResult result = client.query(request.withNextToken(nextToken));
          final long executionTimeMilli = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startExecutionTime);
          final String queryId = result.getQueryId();
          numRequests.incrementAndGet();
          totalReadingTimeMilli.addAndGet(executionTimeMilli);
          nextToken = result.getNextToken();
          while (!resultSets.offer(
            new TimestreamResultHolder(result, executionTimeMilli, null),
            50,
            TimeUnit.MILLISECONDS)) {
            if (resultSet.isClosed()) {
              // Stop the retrieval process if the result set is closed.
              LOGGER.info(
                "Result set is closed while trying to add more result sets to the buffer.\n"
                  + "Query ID: {}\n"
                  + "Time to read results: {}ms\n"
                  + "Total execution time: {}ms\n"
                  + "Total number of pages: {}",
                queryId,
                totalReadingTimeMilli.get(),
                totalReadingTimeMilli.get() + executionTimeForFirstResultSet,
                numRequests);
              return;
            }
          }
        } catch (final Exception e) {
          resultSets.clear();
          nextToken = null;
          if (!resultSets.offer(
            new TimestreamResultHolder(
              null,
              -1,
              Error.createSQLException(LOGGER, e, Error.ASYNC_RETRIEVAL_ERROR, query)))) {
            throw new RuntimeException(Error.getErrorMessage(LOGGER, Error.FAILED_TO_PROPAGATE_ERROR));
          }
        }
      }
      resultSet.getStatement().setResultNoMoreRows();
    }