Skip to content

Commit

Permalink
分range并发下载的并发数调整说明
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreykzli committed Sep 19, 2023
1 parent 03ed9cb commit 81cfd6c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ String localFilePath = "/path/to/localFile";
File downloadFile = new File(localFilePath);

GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, key);
getObjectRequest.setDownloadPartsThreads(4); // 设置分 range 多线程同时下载的并发数,不设置默认为1(此参数在5.6.168及以上版本支持)
try {
// 返回一个异步结果 Download, 可同步的调用 waitForCompletion 等待下载结束, 成功返回 void, 失败抛出异常
Download download = transferManager.download(getObjectRequest, downloadFile, true);
Expand Down Expand Up @@ -181,6 +182,7 @@ shutdownTransferManager(transferManager);
| resumableTaskFile | 断点续传下载时记录信息文件名 | String | file.cosresumabletask |
| multiThreadThreshold | 断点续传下载使用多线程下载的最小文件大小 | int | 20 * 1024 * 1024 |
| partSize | 断点续传下载使用的分块大小 | int | 8 * 1024 * 1024 |
| downloadPartsThreads | 分 range 多线程同时下载的并发数(5.6.168及以上版本支持) | int | 1 |

Request 成员说明:

Expand Down

0 comments on commit 81cfd6c

Please sign in to comment.