Commit c62a8986dd27788f4cee2a1da477868d002c4885
1 parent
cc4c4ac1
优化线程休眠异常日志
Showing
1 changed file
with
6 additions
and
1 deletions
src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
| 1 | package com.genersoft.iot.vmp.utils; | 1 | package com.genersoft.iot.vmp.utils; |
| 2 | 2 | ||
| 3 | +import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookListener; | ||
| 4 | +import org.slf4j.Logger; | ||
| 5 | +import org.slf4j.LoggerFactory; | ||
| 3 | import org.springframework.util.ObjectUtils; | 6 | import org.springframework.util.ObjectUtils; |
| 4 | import oshi.SystemInfo; | 7 | import oshi.SystemInfo; |
| 5 | import oshi.hardware.*; | 8 | import oshi.hardware.*; |
| @@ -21,6 +24,8 @@ import java.util.concurrent.TimeUnit; | @@ -21,6 +24,8 @@ import java.util.concurrent.TimeUnit; | ||
| 21 | */ | 24 | */ |
| 22 | public class SystemInfoUtils { | 25 | public class SystemInfoUtils { |
| 23 | 26 | ||
| 27 | + private final static Logger logger = LoggerFactory.getLogger(SystemInfoUtils.class); | ||
| 28 | + | ||
| 24 | /** | 29 | /** |
| 25 | * 获取cpu信息 | 30 | * 获取cpu信息 |
| 26 | * @return | 31 | * @return |
| @@ -73,7 +78,7 @@ public class SystemInfoUtils { | @@ -73,7 +78,7 @@ public class SystemInfoUtils { | ||
| 73 | try { | 78 | try { |
| 74 | Thread.sleep(1000); | 79 | Thread.sleep(1000); |
| 75 | } catch (InterruptedException e) { | 80 | } catch (InterruptedException e) { |
| 76 | - throw new RuntimeException(e); | 81 | + logger.error("[线程休眠失败] : {}", e.getMessage()); |
| 77 | } | 82 | } |
| 78 | List<NetworkIF> afterNetworkIFs = hal.getNetworkIFs(); | 83 | List<NetworkIF> afterNetworkIFs = hal.getNetworkIFs(); |
| 79 | NetworkIF afterNet = afterNetworkIFs.get(afterNetworkIFs.size() - 1); | 84 | NetworkIF afterNet = afterNetworkIFs.get(afterNetworkIFs.size() - 1); |