in s3-artifact-storage-agent/src/main/java/jetbrains/buildServer/artifacts/s3/download/S3ArtifactTransport.java [165:197]
private boolean isParallelisationPossible(@NotNull String directUrl, @NotNull Path targetFile, @Nullable Long contentLength, boolean acceptsRanges) {
if (contentLength == null || contentLength <= 0) {
LOGGER.debug(String.format("File %s will not be downloaded in parallel: content length is %s", targetFile, contentLength));
return false;
}
if (!acceptsRanges) {
LOGGER.debug(String.format("File %s will not be downloaded in parallel: direct URL %s doesn't accept byte ranges", targetFile, directUrl));
return false;
}
if (myConfiguration.getMaxThreads() == 1) {
LOGGER.debug(String.format("File %s will not be downloaded in parallel: max parallelism is 1 (can be changed by %s configuration parameter)",
targetFile, S3_PARALLEL_DOWNLOAD_MAX_THREADS));
return false;
}
long maxFileSize = myConfiguration.getMaxFileSizeBytes();
if (contentLength >= maxFileSize) {
LOGGER.debug(String.format("File %s will not be downloaded in parallel: file size %s is greater than threshold %s (can be changed by %s configuration parameter)",
targetFile, contentLength, maxFileSize, S3_PARALLEL_DOWNLOAD_MAX_FILE_SIZE_GB));
return false;
}
SplitabilityReport splitabilityReport = myFileSplitter.testSplitability(contentLength);
if (!splitabilityReport.isSplittable()) {
LOGGER.debug(String.format("File %s will not be downloaded in parallel: it cannot be split into parts: %s", targetFile, splitabilityReport.getUnsplitablilityReason()));
return false;
}
LOGGER.debug(String.format("File %s can be downloaded in parallel", targetFile));
return true;
}