From 95c01301f65379e7634e4619bf4c49186aa5be41 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期五, 07 二月 2025 14:19:28 +0800 Subject: [PATCH] !644 同步修复一些问题 Merge pull request !644 from 疯狂的狮子Li/dev --- ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java b/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java index f0760f7..3da1ba5 100644 --- a/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java +++ b/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/factory/OssFactory.java @@ -24,8 +24,7 @@ public class OssFactory { private static final Map<String, OssClient> CLIENT_CACHE = new ConcurrentHashMap<>(); - - private static final ReentrantLock lock = new ReentrantLock(); + private static final ReentrantLock LOCK = new ReentrantLock(); /** * 鑾峰彇榛樿瀹炰緥 @@ -49,11 +48,14 @@ } OssProperties properties = JsonUtils.parseObject(json, OssProperties.class); // 浣跨敤绉熸埛鏍囪瘑閬垮厤澶氫釜绉熸埛鐩稿悓key瀹炰緥瑕嗙洊 - String key = properties.getTenantId() + ":" + configKey; + String key = configKey; + if (StringUtils.isNotBlank(properties.getTenantId())) { + key = properties.getTenantId() + ":" + configKey; + } OssClient client = CLIENT_CACHE.get(key); // 瀹㈡埛绔笉瀛樺湪鎴栭厤缃笉鐩稿悓鍒欓噸鏂版瀯寤� if (client == null || !client.checkPropertiesSame(properties)) { - lock.lock(); + LOCK.lock(); try { client = CLIENT_CACHE.get(key); if (client == null || !client.checkPropertiesSame(properties)) { @@ -62,7 +64,7 @@ return CLIENT_CACHE.get(key); } } finally { - lock.unlock(); + LOCK.unlock(); } } return client; -- Gitblit v1.9.3