amit-jain commented on code in PR #2409:
URL: https://github.com/apache/jackrabbit-oak/pull/2409#discussion_r2435444558


##########
oak-blob-cloud-azure/src/main/java/org/apache/jackrabbit/oak/blob/cloud/azure/blobstorage/AzureBlobStoreBackend.java:
##########
@@ -307,159 +266,117 @@ public InputStream read(DataIdentifier identifier) 
throws DataStoreException {
         }
     }
 
-    @Override
-    public void write(DataIdentifier identifier, File file) throws 
DataStoreException {
-        if (null == identifier) {
-            throw new NullPointerException("identifier");
+    private void tryClose(InputStream is) {
+        if (is != null) {
+            try {
+                is.close();
+            } catch (IOException ioe) {
+                LOG.warn("Failed to close the InputStream {}", is, ioe);
+            }
         }
-        if (null == file) {
-            throw new NullPointerException("file");
+    }
+
+    private void uploadBlob(BlockBlobClient client, File file, long len, 
Stopwatch stopwatch, String key) throws IOException {
+
+        boolean useBufferedStream = len < AZURE_BLOB_BUFFERED_STREAM_THRESHOLD;
+        try (InputStream in = useBufferedStream ?
+                new BufferedInputStream(new FileInputStream(file))
+                : new FileInputStream(file)) {
+
+            ParallelTransferOptions parallelTransferOptions = new 
ParallelTransferOptions()
+                    .setBlockSizeLong(len)
+                    .setMaxConcurrency(concurrentRequestCount)
+                    
.setMaxSingleUploadSizeLong(AZURE_BLOB_MAX_SINGLE_PUT_UPLOAD_SIZE);
+            BlobUploadFromFileOptions options = new 
BlobUploadFromFileOptions(file.toString());
+            options.setParallelTransferOptions(parallelTransferOptions);
+            try {
+                BlobClient blobClient = 
client.getContainerClient().getBlobClient(key);
+                Response<BlockBlobItem> blockBlob = 
blobClient.uploadFromFileWithResponse(options, null, null);
+                LOG.debug("Upload status is {} for blob {}", 
blockBlob.getStatusCode(), key);
+            } catch (UncheckedIOException ex) {
+                System.err.printf("Failed to upload from file: %s%n", 
ex.getMessage());

Review Comment:
   Where is it fixed?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to