优化部分代码
This commit is contained in:
parent
a188d82a7a
commit
1e0b1c6297
6
pom.xml
6
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.1.5</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.lion</groupId>
|
<groupId>com.lion</groupId>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>3.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>3.0.3</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -431,11 +431,14 @@ public class CommunicateService {
|
|||||||
DynamicConfigMessage dynamicConfigMessage = new DynamicConfigMessage();
|
DynamicConfigMessage dynamicConfigMessage = new DynamicConfigMessage();
|
||||||
dynamicConfigMessage.removeIp(id.get());
|
dynamicConfigMessage.removeIp(id.get());
|
||||||
dynamicConfigNotify(dynamicConfigMessage);
|
dynamicConfigNotify(dynamicConfigMessage);
|
||||||
|
ips.remove(id.get());
|
||||||
|
|
||||||
Site site = siteMapper.selectSiteById(id.get());
|
Site site = siteMapper.selectSiteById(id.get());
|
||||||
|
//删除服务器后,服务器下线的场景,这时已从mapper删除
|
||||||
|
if(site == null)
|
||||||
|
return;
|
||||||
webSocketService.statusAlter(site.getHostname(), false);
|
webSocketService.statusAlter(site.getHostname(), false);
|
||||||
siteMapper.updateLastOnlineTime(id.get(), new Date());
|
siteMapper.updateLastOnlineTime(id.get(), new Date());
|
||||||
ips.remove(id.get());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,16 +59,13 @@ public class IoUtil {
|
|||||||
globalMemory = OshiUtil.getMemory();
|
globalMemory = OshiUtil.getMemory();
|
||||||
|
|
||||||
for (NetworkIF nif : networkIFs)
|
for (NetworkIF nif : networkIFs)
|
||||||
if(SystemUtil.getOsInfo().isLinux()) {
|
if (nif.getName().startsWith("eth") || nif.getName().startsWith("ens")) {
|
||||||
if (nif.getName().equals("eth0") || nif.getName().equals("ens3"))
|
networkIF = nif;
|
||||||
networkIF = nif;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if(nif.getName().equals("ethernet_32769"))
|
|
||||||
networkIF = nif;
|
|
||||||
|
|
||||||
if(networkIF == null)
|
if(networkIF == null)
|
||||||
log.error("网卡 eth0 不存在");
|
log.error("网卡 不存在");
|
||||||
else{
|
else{
|
||||||
send = networkIF.getBytesSent();
|
send = networkIF.getBytesSent();
|
||||||
receive = networkIF.getBytesRecv();
|
receive = networkIF.getBytesRecv();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user