فهرست منبع

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

[平台]修复redis缓存问题

See merge request o2oa/o2oa!1630
程剑 5 سال پیش
والد
کامیت
6d549ba166
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 11 1
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/RedisUtil.java

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