From 591331b70cbc47eee427b50e3216f3e3519a2e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 25 Jan 2024 15:05:28 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20!pr485=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/dromara/common/oss/factory/OssFactory.java | 7 +++---- 1 file changed, 3 insertions(+), 4 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 f0760f771..d70270a15 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 @@ import java.util.concurrent.locks.ReentrantLock; public class OssFactory { private static final Map CLIENT_CACHE = new ConcurrentHashMap<>(); - - private static final ReentrantLock lock = new ReentrantLock(); + private static final ReentrantLock LOCK = new ReentrantLock(); /** * 获取默认实例 @@ -53,7 +52,7 @@ public class OssFactory { 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 +61,7 @@ public class OssFactory { return CLIENT_CACHE.get(key); } } finally { - lock.unlock(); + LOCK.unlock(); } } return client;