From 5c8030732ac0cc55d6314d40710e857862c2fe38 Mon Sep 17 00:00:00 2001 From: Vincent Date: Fri, 8 Dec 2023 17:56:39 +0800 Subject: [PATCH] bug report: some AliOss object need to close manually. otherwise will hang up main thread to wait available connection. --- .../sample/component/oss/service/impl/AliyunOssServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/dji/sample/component/oss/service/impl/AliyunOssServiceImpl.java b/src/main/java/com/dji/sample/component/oss/service/impl/AliyunOssServiceImpl.java index cf78637..a55cb85 100644 --- a/src/main/java/com/dji/sample/component/oss/service/impl/AliyunOssServiceImpl.java +++ b/src/main/java/com/dji/sample/component/oss/service/impl/AliyunOssServiceImpl.java @@ -86,6 +86,7 @@ public class AliyunOssServiceImpl implements IOssService { @Override 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(); } @@ -94,6 +95,7 @@ public class AliyunOssServiceImpl implements IOssService { if (ossClient.doesObjectExist(bucket, objectKey)) { 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())); log.info("Upload FlighttaskCreateFile: {}", objectResult.getETag()); }