mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 18:15:56 +08:00
解决oom的问题
This commit is contained in:
parent
6f83ed3285
commit
3b679c4e79
@ -97,6 +97,11 @@ public class OssClient {
|
|||||||
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请检查配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请检查配置信息:[" + e.getMessage() + "]");
|
||||||
|
}finally {
|
||||||
|
//如果是阿里云时,必须关闭数据量大时,否则会出现oom的情况
|
||||||
|
if (client != null) {
|
||||||
|
client.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return UploadResult.builder().url(getUrl() + "/" + path).filename(path).build();
|
return UploadResult.builder().url(getUrl() + "/" + path).filename(path).build();
|
||||||
}
|
}
|
||||||
@ -107,6 +112,10 @@ public class OssClient {
|
|||||||
client.deleteObject(properties.getBucketName(), path);
|
client.deleteObject(properties.getBucketName(), path);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new OssException("上传文件失败,请检查配置信息:[" + e.getMessage() + "]");
|
throw new OssException("上传文件失败,请检查配置信息:[" + e.getMessage() + "]");
|
||||||
|
}finally {
|
||||||
|
if (client != null) {
|
||||||
|
client.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user