瀏覽代碼

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

18339543638 4 年之前
父節點
當前提交
f0f4898840
共有 1 個文件被更改,包括 8 次插入6 次删除
  1. 8 6
      jetlinks-core/src/main/java/org/jetlinks/core/cluster/ServerNode.java

+ 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);