Просмотр исходного кода

Merge branch 'fix/redis缓存问题' into 'develop'

[平台]修复redis缓存问题

See merge request o2oa/o2oa!1630
程剑 5 лет назад
Родитель
Сommit
6d549ba166

+ 11 - 1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/RedisUtil.java

@@ -82,12 +82,17 @@ public class RedisUtil {
             if (jedisPool == null) {
                 initJedisPool();
                 log.debug("JedisPool init success!");
+            }
+            if (jedisPool != null) {
                 resource = jedisPool.getResource();
             }
         } catch (Exception e) {
             log.warn("JedisPool init error: {}", e.getMessage());
         }
         lockPool.unlock();
+        if(resource == null){
+            log.warn("get redis connect from redisPool is null");
+        }
         return resource;
     }
 
@@ -106,7 +111,12 @@ public class RedisUtil {
     }
 
     public static void closePool() {
-        jedisPool.destroy();
+        try {
+            if(jedisPool != null) {
+                jedisPool.destroy();
+            }
+        } catch (Exception e) {
+        }
     }
 
 }