Merge pull request #739 from xiaoQQya/wvp-28181-2.0

序列化问题修复与代码优化
pull/742/head
648540858 2023-02-06 10:35:16 +08:00 committed by GitHub
commit fdd732250a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -36,7 +36,7 @@ public class ZLMRESTfulUtils {
// 设置连接超时时间 // 设置连接超时时间
httpClientBuilder.connectTimeout(5,TimeUnit.SECONDS); httpClientBuilder.connectTimeout(5,TimeUnit.SECONDS);
// 设置读取超时时间 // 设置读取超时时间
httpClientBuilder.readTimeout(5,TimeUnit.SECONDS); httpClientBuilder.readTimeout(10,TimeUnit.SECONDS);
// 设置连接池 // 设置连接池
httpClientBuilder.connectionPool(new ConnectionPool(16, 5, TimeUnit.MINUTES)); httpClientBuilder.connectionPool(new ConnectionPool(16, 5, TimeUnit.MINUTES));
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {

View File

@ -27,11 +27,10 @@ public final class JsonUtil {
* @return result type * @return result type
*/ */
public static <T> T redisJsonToObject(String key, Class<T> clazz) { public static <T> T redisJsonToObject(String key, Class<T> clazz) {
JSONObject jsonObject = (JSONObject) RedisUtil.get(key); Object jsonObject = RedisUtil.get(key);
if (Objects.isNull(jsonObject)) { if (Objects.isNull(jsonObject)) {
return null; return null;
} }
return JSON.parseObject(jsonObject.toJSONString(), clazz); return clazz.cast(jsonObject);
} }
} }