mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
94474: Transfer manger should be class wide
This commit is contained in:
@@ -75,6 +75,12 @@ public class S3BitStoreService implements BitStoreService {
|
||||
*/
|
||||
private AmazonS3 s3Service = null;
|
||||
|
||||
/**
|
||||
* S3 transfer manager
|
||||
* this is reused between put calls to use less resources for multiple uploads
|
||||
*/
|
||||
private TransferManager tm = null;
|
||||
|
||||
private static final ConfigurationService configurationService
|
||||
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
public S3BitStoreService() {
|
||||
@@ -128,6 +134,11 @@ public class S3BitStoreService implements BitStoreService {
|
||||
}
|
||||
|
||||
log.info("AWS S3 Assetstore ready to go! bucket:" + bucketName);
|
||||
|
||||
tm = TransferManagerBuilder.standard()
|
||||
.withAlwaysCalculateMultipartMd5(true)
|
||||
.withS3Client(s3Service)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -184,12 +195,6 @@ public class S3BitStoreService implements BitStoreService {
|
||||
// Therefore, we precalculate before uploading
|
||||
String localChecksum = org.dspace.curate.Utils.checksum(scratchFile, CSA);
|
||||
|
||||
TransferManager tm = TransferManagerBuilder.standard()
|
||||
.withAlwaysCalculateMultipartMd5(true)
|
||||
.withS3Client(s3Service)
|
||||
.build();
|
||||
|
||||
|
||||
Upload upload = tm.upload(bucketName, key, scratchFile);
|
||||
|
||||
upload.waitForUploadResult();
|
||||
|
Reference in New Issue
Block a user