From b9f0c70222be8ef9be5c7cdd205972d9805ec669 Mon Sep 17 00:00:00 2001 From: Sydney Munro Date: Thu, 11 Apr 2024 14:38:26 -0700 Subject: [PATCH] pr comments --- .../transfermanager/TransferManagerImpl.java | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/TransferManagerImpl.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/TransferManagerImpl.java index 098b4eb864..44bc3cfb5f 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/TransferManagerImpl.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/TransferManagerImpl.java @@ -25,8 +25,6 @@ import com.google.cloud.storage.BlobId; import com.google.cloud.storage.BlobInfo; import com.google.cloud.storage.BlobWriteSessionConfigs; -import com.google.cloud.storage.GrpcStorageOptions; -import com.google.cloud.storage.HttpStorageOptions; import com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig; import com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig.ExecutorSupplier; import com.google.cloud.storage.Storage; @@ -82,23 +80,11 @@ final class TransferManagerImpl implements TransferManager { .build(); } // Create the blobWriteSessionConfig for ParallelCompositeUpload - ParallelCompositeUploadBlobWriteSessionConfig pcuConfig = - BlobWriteSessionConfigs.parallelCompositeUpload() - .withExecutorSupplier(ExecutorSupplier.useExecutor(executor)); - if (storageOptions instanceof GrpcStorageOptions - && transferManagerConfig.isAllowParallelCompositeUpload()) { - storageOptions = - ((GrpcStorageOptions) storageOptions) - .toBuilder() - .setBlobWriteSessionConfig(pcuConfig) - .build(); - } else if (storageOptions instanceof HttpStorageOptions - && transferManagerConfig.isAllowParallelCompositeUpload()) { - storageOptions = - ((HttpStorageOptions) storageOptions) - .toBuilder() - .setBlobWriteSessionConfig(pcuConfig) - .build(); + if (transferManagerConfig.isAllowParallelCompositeUpload()) { + ParallelCompositeUploadBlobWriteSessionConfig pcuConfig = + BlobWriteSessionConfigs.parallelCompositeUpload() + .withExecutorSupplier(ExecutorSupplier.useExecutor(executor)); + storageOptions = storageOptions.toBuilder().setBlobWriteSessionConfig(pcuConfig).build(); } pcuQueue = new ArrayDeque<>(); this.storage = storageOptions.getService();