#vulnerable code 
                              @Override
  public Status scan(String table, String startkey, int recordcount, Set<String> fields,
                     Vector<HashMap<String, ByteIterator>> result) {
    List<Document> documents;
    FeedResponse<Document> feedResponse = null;
    try {
      feedResponse = AzureCosmosClient.client.queryDocuments(getDocumentCollectionLink(this.databaseName, table),
            new SqlQuerySpec(queryText,
                    new SqlParameterCollection(new SqlParameter("@recordcount", recordcount),
                            new SqlParameter("@startkey", startkey))),
            getFeedOptions(startkey));
      documents = feedResponse.getQueryIterable().toList();
    } catch (Exception e) {
      if (!this.includeExceptionStackInLog) {
        e = null;
      }
      LOGGER.error("Failed to scan with startKey={}, recordCount={}", startkey, recordcount, e);
      return Status.ERROR;
    }

    if (documents != null) {
      for (Document document : documents) {
        result.add(this.extractResult(document));
      }
    }

    return Status.OK;
  } 
                            #location 11 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                              @Override
  public Status scan(String table, String startkey, int recordcount, Set<String> fields,
                     Vector<HashMap<String, ByteIterator>> result) {
    List<Document> documents;
    FeedResponse<Document> feedResponse = null;
    try {
      FeedOptions feedOptions = new FeedOptions();
      feedOptions.setEnableCrossPartitionQuery(true);
      feedOptions.setMaxDegreeOfParallelism(this.maxDegreeOfParallelismForQuery);
      feedResponse = AzureCosmosClient.client.queryDocuments(getDocumentCollectionLink(this.databaseName, table),
            new SqlQuerySpec("SELECT TOP @recordcount * FROM root r WHERE r.id >= @startkey",
                    new SqlParameterCollection(new SqlParameter("@recordcount", recordcount),
                                               new SqlParameter("@startkey", startkey))),
                    feedOptions);
      documents = feedResponse.getQueryIterable().toList();
    } catch (Exception e) {
      if (!this.includeExceptionStackInLog) {
        e = null;
      }
      LOGGER.error("Failed to scan with startKey={}, recordCount={}", startkey, recordcount, e);
      return Status.ERROR;
    }

    if (documents != null) {
      for (Document document : documents) {
        result.add(this.extractResult(document));
      }
    }

    return Status.OK;
  }