Browse Source

fixed 设备删除
add 集群消息回复
add 集群id不可重复

18339543638 4 years ago
parent
commit
f0f4898840

+ 8 - 6
jetlinks-core/src/main/java/org/jetlinks/core/cluster/ServerNode.java

@@ -32,14 +32,16 @@ public class ServerNode implements Serializable {
 
     private long lastKeepAlive;
 
-    private String macId;
+    private long keepAliveTime;
 
-    private long startTime;
-    {
-        macId= MacUtils.getMac(MacUtils.getInetAddress());
-        startTime=System.currentTimeMillis();
-    }
+    private final String macId= MacUtils.getMac(MacUtils.getInetAddress());
+
+    private final long startTime=System.currentTimeMillis();
 
+    public void setLastKeepAlive(long lastKeepAlive) {
+        this.lastKeepAlive = lastKeepAlive;
+        this.keepAliveTime=lastKeepAlive-startTime;
+    }
 
     public boolean hasTag(String tag) {
         return tags != null && tags.containsKey(tag);