@Override
public StorageObject upload(final Path file, Local local, final BandwidthThrottle throttle, final StreamListener listener,
final TransferStatus status, final ConnectionCallback prompt) throws BackgroundException {
if(status.getLength() > multipartThreshold) {
if(!preferences.getBoolean("s3.upload.multipart")) {
log.warn("Multipart upload is disabled with property s3.upload.multipart");
if(status.getLength() < preferences.getLong("s3.upload.multipart.required.threshold")) {
return new S3SingleUploadService(session, writer).upload(file, local, throttle, listener, status, prompt);
}
}
try {
return new S3MultipartUploadService(session, writer).upload(file, local, throttle, listener, status, prompt);
}
catch(NotfoundException | InteroperabilityException e) {
log.warn(String.format("Failure using multipart upload %s. Fallback to single upload.", e.getMessage()));
}
}
return new S3SingleUploadService(session, writer).upload(file, local, throttle, listener, status, prompt);
}