1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

sync to finchley before graduation

This commit is contained in:
fangjian0423
2019-07-27 18:16:32 +08:00
parent c459080f05
commit 301d133238
33 changed files with 671 additions and 155 deletions

View File

@@ -155,6 +155,21 @@ public class NacosDiscoveryProperties {
*/
private String secretKey;
/**
* Heart beat interval. Time unit: second.
*/
private Integer heartBeatInterval;
/**
* Heart beat timeout. Time unit: second.
*/
private Integer heartBeatTimeout;
/**
* Ip delete timeout. Time unit: second.
*/
private Integer ipDeleteTimeout;
@Autowired
private InetUtils inetUtils;
@@ -339,6 +354,30 @@ public class NacosDiscoveryProperties {
this.secretKey = secretKey;
}
public Integer getHeartBeatInterval() {
return heartBeatInterval;
}
public void setHeartBeatInterval(Integer heartBeatInterval) {
this.heartBeatInterval = heartBeatInterval;
}
public Integer getHeartBeatTimeout() {
return heartBeatTimeout;
}
public void setHeartBeatTimeout(Integer heartBeatTimeout) {
this.heartBeatTimeout = heartBeatTimeout;
}
public Integer getIpDeleteTimeout() {
return ipDeleteTimeout;
}
public void setIpDeleteTimeout(Integer ipDeleteTimeout) {
this.ipDeleteTimeout = ipDeleteTimeout;
}
public String getNamingLoadCacheAtStart() {
return namingLoadCacheAtStart;
}

View File

@@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.PreservedMetadataKeys;
/**
* @author xiaojing
@@ -76,6 +77,19 @@ public class NacosRegistration implements Registration, ServiceInstance {
metadata.put(MANAGEMENT_ADDRESS, address);
}
}
if (null != nacosDiscoveryProperties.getHeartBeatInterval()) {
metadata.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL,
nacosDiscoveryProperties.getHeartBeatInterval().toString());
}
if (null != nacosDiscoveryProperties.getHeartBeatTimeout()) {
metadata.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT,
nacosDiscoveryProperties.getHeartBeatTimeout().toString());
}
if (null != nacosDiscoveryProperties.getIpDeleteTimeout()) {
metadata.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT,
nacosDiscoveryProperties.getIpDeleteTimeout().toString());
}
}
@Override