mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
Pre Merge pull request !448 from simple/多次创建创建OSS实例问题
This commit is contained in:
commit
0163bcf328
@ -48,11 +48,16 @@ public class OssFactory {
|
|||||||
// 使用租户标识避免多个租户相同key实例覆盖
|
// 使用租户标识避免多个租户相同key实例覆盖
|
||||||
String key = properties.getTenantId() + ":" + configKey;
|
String key = properties.getTenantId() + ":" + configKey;
|
||||||
OssClient client = CLIENT_CACHE.get(key);
|
OssClient client = CLIENT_CACHE.get(key);
|
||||||
|
if (client == null) {
|
||||||
|
synchronized (CLIENT_CACHE) {
|
||||||
|
client = CLIENT_CACHE.get(key);
|
||||||
if (client == null) {
|
if (client == null) {
|
||||||
CLIENT_CACHE.put(key, new OssClient(configKey, properties));
|
CLIENT_CACHE.put(key, new OssClient(configKey, properties));
|
||||||
log.info("创建OSS实例 key => {}", configKey);
|
log.info("创建OSS实例 key => {}", configKey);
|
||||||
return CLIENT_CACHE.get(key);
|
return CLIENT_CACHE.get(key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 配置不相同则重新构建
|
// 配置不相同则重新构建
|
||||||
if (!client.checkPropertiesSame(properties)) {
|
if (!client.checkPropertiesSame(properties)) {
|
||||||
CLIENT_CACHE.put(key, new OssClient(configKey, properties));
|
CLIENT_CACHE.put(key, new OssClient(configKey, properties));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user