From 2717f036ecd209d52b31153e1e0f5adccd3a0cd2 Mon Sep 17 00:00:00 2001 From: thinkgem Date: Mon, 24 Sep 2018 12:21:15 +0800 Subject: [PATCH] update --- .../com/jeesite/common/lang/ObjectUtils.java | 20 +++++++++---------- .../main/resources/config/j2cache.properties | 1 - 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java b/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java index 2d370ed3..657d10bf 100644 --- a/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java +++ b/common/src/main/java/com/jeesite/common/lang/ObjectUtils.java @@ -158,7 +158,7 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { * @param object * @return */ - public static byte[] serialize(T object) { + public static byte[] serialize(Object object) { if (object == null){ return null; } @@ -183,17 +183,16 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { * @param bytes * @return */ - @SuppressWarnings("unchecked") - public static T unserialize(byte[] bytes) { + public static Object unserialize(byte[] bytes) { if (bytes == null){ return null; } long beginTime = System.currentTimeMillis(); - T object = null; + Object object = null; if (bytes.length > 0) { try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bais);) { - object = (T)ois.readObject(); + object = ois.readObject(); } catch (Exception e) { e.printStackTrace(); } @@ -217,7 +216,7 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { * @param object * @return */ - public static byte[] serializeFst(T object) { + public static byte[] serializeFst(Object object) { if (object == null){ return null; } @@ -235,13 +234,12 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { * @param bytes * @return */ - @SuppressWarnings("unchecked") - public static T unserializeFst(byte[] bytes) { + public static Object unserializeFst(byte[] bytes) { if (bytes == null){ return null; } long beginTime = System.currentTimeMillis(); - T object = (T)fst.get().asObject(bytes); + Object object = fst.get().asObject(bytes); long totalTime = System.currentTimeMillis() - beginTime; if (totalTime > 3000){ System.out.println("Fst unserialize time: " + TimeUtils.formatDateAgo(totalTime)); @@ -253,12 +251,12 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { * 克隆一个对象(完全拷贝) * @param source */ - public static T cloneBean(T source){ + public static Object cloneBean(Object source){ if (source == null){ return null; } byte[] bytes = ObjectUtils.serializeFst(source); - T target = ObjectUtils.unserializeFst(bytes); + Object target = ObjectUtils.unserializeFst(bytes); return target; } diff --git a/web/src/main/resources/config/j2cache.properties b/web/src/main/resources/config/j2cache.properties index 981d5e41..5e1b29de 100644 --- a/web/src/main/resources/config/j2cache.properties +++ b/web/src/main/resources/config/j2cache.properties @@ -80,7 +80,6 @@ caffeine.region.sessionCache = 100000, 30m #redis storage mode (generic|hash) redis.storage = generic -#redis.storage = hash ## redis pub/sub channel name redis.channel = j2cache