#502 Add NONE healthChecker
This commit is contained in:
parent
7bf60c18e7
commit
592f2b4301
@ -47,6 +47,20 @@ public abstract class AbstractHealthChecker implements Cloneable {
|
||||
*/
|
||||
public abstract AbstractHealthChecker clone() throws CloneNotSupportedException;
|
||||
|
||||
public static class None extends AbstractHealthChecker {
|
||||
|
||||
public static final String TYPE = "NONE";
|
||||
|
||||
public None() {
|
||||
this.setType(TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractHealthChecker clone() throws CloneNotSupportedException {
|
||||
return new None();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Http extends AbstractHealthChecker {
|
||||
public static final String TYPE = "HTTP";
|
||||
|
||||
|
@ -87,6 +87,9 @@ public class ClusterController {
|
||||
case AbstractHealthChecker.Mysql.TYPE:
|
||||
abstractHealthChecker = JSON.parseObject(healthChecker, AbstractHealthChecker.Mysql.class);
|
||||
break;
|
||||
case AbstractHealthChecker.None.TYPE:
|
||||
abstractHealthChecker = JSON.parseObject(healthChecker, AbstractHealthChecker.None.class);
|
||||
break;
|
||||
default:
|
||||
throw new NacosException(NacosException.INVALID_PARAM, "unknown health check type:" + healthChecker);
|
||||
}
|
||||
|
@ -133,13 +133,13 @@ public class Instance extends com.alibaba.nacos.api.naming.pojo.Instance impleme
|
||||
if (ipAddressAttributes.length > minimumLength) {
|
||||
// determine 'valid':
|
||||
if (Boolean.TRUE.toString().equals(ipAddressAttributes[minimumLength]) ||
|
||||
Boolean.FALSE.toString().equals(ipAddressAttributes[minimumLength])) {
|
||||
Boolean.FALSE.toString().equals(ipAddressAttributes[minimumLength])) {
|
||||
instance.setHealthy(Boolean.parseBoolean(ipAddressAttributes[minimumLength]));
|
||||
}
|
||||
|
||||
// determine 'cluster':
|
||||
if (!Boolean.TRUE.toString().equals(ipAddressAttributes[ipAddressAttributes.length - 1]) &&
|
||||
!Boolean.FALSE.toString().equals(ipAddressAttributes[ipAddressAttributes.length - 1])) {
|
||||
!Boolean.FALSE.toString().equals(ipAddressAttributes[ipAddressAttributes.length - 1])) {
|
||||
instance.setClusterName(ipAddressAttributes[ipAddressAttributes.length - 1]);
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ public class Instance extends com.alibaba.nacos.api.naming.pojo.Instance impleme
|
||||
if (ipAddressAttributes.length > minimumLength) {
|
||||
// determine 'marked':
|
||||
if (Boolean.TRUE.toString().equals(ipAddressAttributes[minimumLength]) ||
|
||||
Boolean.FALSE.toString().equals(ipAddressAttributes[minimumLength])) {
|
||||
Boolean.FALSE.toString().equals(ipAddressAttributes[minimumLength])) {
|
||||
instance.setMarked(Boolean.parseBoolean(ipAddressAttributes[minimumLength]));
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,8 @@ public class Instance extends com.alibaba.nacos.api.naming.pojo.Instance impleme
|
||||
Instance other = (Instance) obj;
|
||||
|
||||
// 0 means wild
|
||||
return getIp().equals(other.getIp()) && (getPort() == other.getPort() || getPort() == 0);
|
||||
return getIp().equals(other.getIp()) && (getPort() == other.getPort() || getPort() == 0)
|
||||
&& this.isEphemeral() == other.isEphemeral();
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
|
Loading…
Reference in New Issue
Block a user