Skip to content

Commit

Permalink
Merge branch 'multi-region'
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSen-qn committed Dec 7, 2023
2 parents aa679cc + 03355a3 commit 5febea7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void uploadNextData(final PartsUploadPerformerDataCompleteHandler completeHandle
UploadBlock block = null;
UploadData chunk = null;

synchronized (this) {
synchronized (uploadSource) {
try {
block = info.nextUploadBlock();
chunk = info.nextUploadData(block);
Expand Down Expand Up @@ -108,13 +108,17 @@ public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics reque
}
}
if (responseInfo.isOK() && ctx != null && expiredAt != null) {
uploadBlock.ctx = ctx;
uploadBlock.expireAt = expiredAt;
uploadChunk.updateState(UploadData.State.Complete);
synchronized (uploadSource) {
uploadBlock.ctx = ctx;
uploadBlock.expireAt = expiredAt;
uploadChunk.updateState(UploadData.State.Complete);
}
recordUploadInfo();
notifyProgress(false);
} else {
uploadChunk.updateState(UploadData.State.WaitToUpload);
synchronized (uploadSource) {
uploadChunk.updateState(UploadData.State.WaitToUpload);
}
}
completeHandler.complete(false, responseInfo, requestMetrics, response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.List;
import java.util.Map;

import kotlin.jvm.Synchronized;

class PartsUploadPerformerV2 extends PartsUploadPerformer {

PartsUploadPerformerV2(UploadSource uploadSource,
Expand Down Expand Up @@ -79,7 +81,7 @@ void uploadNextData(final PartsUploadPerformerDataCompleteHandler completeHandle
final UploadInfoV2 info = (UploadInfoV2) uploadInfo;

UploadData data = null;
synchronized (this) {
synchronized (uploadSource) {
try {
data = info.nextUploadData();
if (data != null) {
Expand Down Expand Up @@ -134,12 +136,16 @@ public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics reque
}
}
if (responseInfo.isOK() && etag != null && md5 != null) {
uploadData.etag = etag;
uploadData.updateState(UploadData.State.Complete);
synchronized (uploadSource) {
uploadData.etag = etag;
uploadData.updateState(UploadData.State.Complete);
}
recordUploadInfo();
notifyProgress(false);
} else {
uploadData.updateState(UploadData.State.WaitToUpload);
synchronized (uploadSource) {
uploadData.updateState(UploadData.State.WaitToUpload);
}
}
completeHandler.complete(false, responseInfo, requestMetrics, response);
}
Expand Down

0 comments on commit 5febea7

Please sign in to comment.