Browse Source

bug report: some AliOss object need to close manually. otherwise will hang up main thread to wait available connection.

pull/46/head
Vincent 1 year ago
parent
commit
5c8030732a
  1. 2
      src/main/java/com/dji/sample/component/oss/service/impl/AliyunOssServiceImpl.java

2
src/main/java/com/dji/sample/component/oss/service/impl/AliyunOssServiceImpl.java

@ -86,6 +86,7 @@ public class AliyunOssServiceImpl implements IOssService {
@Override @Override
public InputStream getObject(String bucket, String objectKey) { public InputStream getObject(String bucket, String objectKey) {
//bug: ossClient.getObject -> OSSObject need to close manually. otherwise will hang up main thread to wait available connection. by witcom @2023.12.08
return ossClient.getObject(bucket, objectKey).getObjectContent(); return ossClient.getObject(bucket, objectKey).getObjectContent();
} }
@ -94,6 +95,7 @@ public class AliyunOssServiceImpl implements IOssService {
if (ossClient.doesObjectExist(bucket, objectKey)) { if (ossClient.doesObjectExist(bucket, objectKey)) {
throw new RuntimeException("The filename already exists."); throw new RuntimeException("The filename already exists.");
} }
//bug: PutObjectResult need to close manually. otherwise will hang up main thread to wait available connection. by witcom @2023.12.08
PutObjectResult objectResult = ossClient.putObject(new PutObjectRequest(bucket, objectKey, input, new ObjectMetadata())); PutObjectResult objectResult = ossClient.putObject(new PutObjectRequest(bucket, objectKey, input, new ObjectMetadata()));
log.info("Upload FlighttaskCreateFile: {}", objectResult.getETag()); log.info("Upload FlighttaskCreateFile: {}", objectResult.getETag());
} }

Loading…
Cancel
Save