Commit fdd732250a599509f54a0408143f7803dff7febc
Committed by
GitHub
Merge pull request #739 from xiaoQQya/wvp-28181-2.0
序列化问题修复与代码优化
Showing
2 changed files
with
3 additions
and
4 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
| ... | ... | @@ -36,7 +36,7 @@ public class ZLMRESTfulUtils { |
| 36 | 36 | // 设置连接超时时间 |
| 37 | 37 | httpClientBuilder.connectTimeout(5,TimeUnit.SECONDS); |
| 38 | 38 | // 设置读取超时时间 |
| 39 | - httpClientBuilder.readTimeout(5,TimeUnit.SECONDS); | |
| 39 | + httpClientBuilder.readTimeout(10,TimeUnit.SECONDS); | |
| 40 | 40 | // 设置连接池 |
| 41 | 41 | httpClientBuilder.connectionPool(new ConnectionPool(16, 5, TimeUnit.MINUTES)); |
| 42 | 42 | if (logger.isDebugEnabled()) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java
| ... | ... | @@ -27,11 +27,10 @@ public final class JsonUtil { |
| 27 | 27 | * @return result type |
| 28 | 28 | */ |
| 29 | 29 | public static <T> T redisJsonToObject(String key, Class<T> clazz) { |
| 30 | - JSONObject jsonObject = (JSONObject) RedisUtil.get(key); | |
| 30 | + Object jsonObject = RedisUtil.get(key); | |
| 31 | 31 | if (Objects.isNull(jsonObject)) { |
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | - return JSON.parseObject(jsonObject.toJSONString(), clazz); | |
| 34 | + return clazz.cast(jsonObject); | |
| 35 | 35 | } |
| 36 | - | |
| 37 | 36 | } |
| 38 | 37 | \ No newline at end of file | ... | ... |