Skip to content

Commit 3bcc743

Browse files
committed
Update to 3.21.12
Replace log4j2 to 2.17.0
1 parent 6b5a916 commit 3bcc743

File tree

2 files changed

+4
-243
lines changed

2 files changed

+4
-243
lines changed

app/src/main/java/com/obs/services/internal/ConcurrentProgressManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,18 @@ public void progressEnd() {
6262
protected void doProgressChanged(int bytes) {
6363
long transferred = this.transferredBytes.addAndGet(bytes);
6464
long newlyTransferred = this.newlyTransferredBytes.addAndGet(bytes);
65+
// 获取当前时间戳,减去上次更新速度的时间,如若时间差大于 1000ms,则对上一秒传输字节数进行更新
6566
long now = System.currentTimeMillis();
67+
// 采用局部变量保证线程安全
6668
long swapIntervalTime = now - lastSwapTimeStamp.get();
6769
currentSecondBytes.addAndGet(bytes);
70+
// 上一秒传输字节设置为 当前传输字节 / 耗时,更新当前传输字节为 0,重设更新时间
6871
if (swapIntervalTime > 1000) {
6972
lastSecondBytes.set((long) (currentSecondBytes.get() / (swapIntervalTime / 1000.0)));
7073
currentSecondBytes.set(0);
7174
lastSwapTimeStamp.set(now);
7275
}
76+
// 当新传输字节数大于用户设置阈值时更新回调函数,其中瞬时速度使用上一秒传输字节数作为近似值
7377
if (newlyTransferred >= this.intervalBytes
7478
&& (transferred < this.totalBytes || this.totalBytes == -1)) {
7579
if (this.newlyTransferredBytes.compareAndSet(newlyTransferred, -newlyTransferred)) {

pom-mvn-center.xml

Lines changed: 0 additions & 243 deletions
This file was deleted.

0 commit comments

Comments
 (0)