Source:
List<CloudBlobMetadata> getContainerBlobs(String partitionPath, short accountId, short containerId, int queryLimit) throws DocumentClientException { String query = String.format(CONTAINER_BLOBS_QUERY, accountId, containerId); SqlQuerySpec querySpec = new SqlQuerySpec(query); FeedOptions feedOptions = new FeedOptions(); feedOptions.setMaxItemCount(queryLimit); feedOptions.setResponseContinuationTokenLimitInKb(continuationTokenLimitKb); feedOptions.setPartitionKey(new PartitionKey(partitionPath)); try { Iterator<FeedResponse<Document>> iterator = executeCosmosQuery(partitionPath, querySpec, feedOptions, azureMetrics.deletedContainerBlobsQueryTime).getIterator(); List<CloudBlobMetadata> containerBlobsList = new ArrayList<>(); double requestCharge = 0.0; while (iterator.hasNext()) { FeedResponse<Document> response = iterator.next(); requestCharge += response.getRequestCharge(); response.getResults() .iterator() .forEachRemaining(doc -> containerBlobsList.add(createMetadataFromDocument(doc))); } if (requestCharge >= requestChargeThreshold) { logger.info( "Deleted container blobs query partition containerId accountId request charge for records", partitionPath, containerId, accountId, requestCharge, containerBlobsList.size()); } return containerBlobsList; } catch (RuntimeException rex) { if (rex.getCause() instanceof DocumentClientException) { logger.warn("Dead blobs query partition got {}", query, partitionPath, ((DocumentClientException) rex.getCause()).getStatusCode()); throw (DocumentClientException) rex.getCause(); } throw rex; } }

Target:
List<CloudBlobMetadata> getContainerBlobs(String partitionPath, short accountId, short containerId, int queryLimit) throws DocumentClientException { SqlQuerySpec querySpec = new SqlQuerySpec(CONTAINER_BLOBS_QUERY, new SqlParameterCollection(new SqlParameter(LIMIT_PARAM, queryLimit), new SqlParameter(CONTAINER_ID_PARAM, containerId), new SqlParameter(ACCOUNT_ID_PARAM, accountId))); FeedOptions feedOptions = new FeedOptions(); feedOptions.setMaxItemCount(queryLimit); feedOptions.setResponseContinuationTokenLimitInKb(continuationTokenLimitKb); feedOptions.setPartitionKey(new PartitionKey(partitionPath)); try { Iterator<FeedResponse<Document>> iterator = executeCosmosQuery(partitionPath, querySpec, feedOptions, azureMetrics.deletedContainerBlobsQueryTime).getIterator(); List<CloudBlobMetadata> containerBlobsList = new ArrayList<>(); double requestCharge = 0.0; while (iterator.hasNext()) { FeedResponse<Document> response = iterator.next(); requestCharge += response.getRequestCharge(); response.getResults() .iterator() .forEachRemaining(doc -> containerBlobsList.add(createMetadataFromDocument(doc))); } if (requestCharge >= requestChargeThreshold) { logger.info( "Deleted container blobs query partition containerId accountId request charge for records", partitionPath, containerId, accountId, requestCharge, containerBlobsList.size()); } return containerBlobsList; } catch (RuntimeException rex) { if (rex.getCause() instanceof DocumentClientException) { logger.warn("Dead blobs query partition got {}", querySpec.getQueryText(), partitionPath, ((DocumentClientException) rex.getCause()).getStatusCode()); throw (DocumentClientException) rex.getCause(); } throw rex; } }