Solve conflict from develop
This commit is contained in:
parent
902f501fac
commit
995dce0bc0
@ -54,6 +54,8 @@ public class ServiceInfoHolder implements Closeable {
|
||||
|
||||
private final FailoverReactor failoverReactor;
|
||||
|
||||
private final boolean pushEmptyProtection;
|
||||
|
||||
private String cacheDir;
|
||||
|
||||
public ServiceInfoHolder(String namespace, Properties properties) {
|
||||
@ -64,6 +66,7 @@ public class ServiceInfoHolder implements Closeable {
|
||||
this.serviceInfoMap = new ConcurrentHashMap<String, ServiceInfo>(16);
|
||||
}
|
||||
this.failoverReactor = new FailoverReactor(this, cacheDir);
|
||||
this.pushEmptyProtection = isPushEmptyProtect(properties);
|
||||
}
|
||||
|
||||
private void initCacheDir(String namespace) {
|
||||
@ -87,6 +90,16 @@ public class ServiceInfoHolder implements Closeable {
|
||||
return loadCacheAtStart;
|
||||
}
|
||||
|
||||
private boolean isPushEmptyProtect(Properties properties) {
|
||||
boolean pushEmptyProtection = false;
|
||||
if (properties != null && StringUtils
|
||||
.isNotEmpty(properties.getProperty(PropertyKeyConst.NAMING_PUSH_EMPTY_PROTECTION))) {
|
||||
pushEmptyProtection = ConvertUtils
|
||||
.toBoolean(properties.getProperty(PropertyKeyConst.NAMING_PUSH_EMPTY_PROTECTION));
|
||||
}
|
||||
return pushEmptyProtection;
|
||||
}
|
||||
|
||||
public Map<String, ServiceInfo> getServiceInfoMap() {
|
||||
return serviceInfoMap;
|
||||
}
|
||||
@ -121,7 +134,7 @@ public class ServiceInfoHolder implements Closeable {
|
||||
*/
|
||||
public ServiceInfo processServiceInfo(ServiceInfo serviceInfo) {
|
||||
ServiceInfo oldService = serviceInfoMap.get(serviceInfo.getKey());
|
||||
if (serviceInfo.getHosts() == null || !serviceInfo.validate()) {
|
||||
if (null == serviceInfo.getHosts() || (pushEmptyProtection && !serviceInfo.validate())) {
|
||||
//empty or error push, just ignore
|
||||
return oldService;
|
||||
}
|
||||
|
@ -312,6 +312,9 @@ public class UdpPushService implements ApplicationContextAware, ApplicationListe
|
||||
} else if (ClientInfo.ClientType.GO == clientInfo.type
|
||||
&& clientInfo.version.compareTo(VersionUtil.parseVersion(switchDomain.getPushGoVersion())) >= 0) {
|
||||
return true;
|
||||
} else if (ClientInfo.ClientType.CSHARP == clientInfo.type
|
||||
&& clientInfo.version.compareTo(VersionUtil.parseVersion(switchDomain.getPushCSharpVersion())) >= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -61,6 +61,10 @@ public class ClientInfo {
|
||||
* C client type.
|
||||
*/
|
||||
C(ClientTypeDescription.C_CLIENT),
|
||||
/**
|
||||
* CSharp client type.
|
||||
*/
|
||||
CSHARP(ClientTypeDescription.CSHARP_CLIENT),
|
||||
/**
|
||||
* php client type.
|
||||
*/
|
||||
@ -123,6 +127,8 @@ public class ClientInfo {
|
||||
public static final String GO_CLIENT = "Nacos-Go-Client";
|
||||
|
||||
public static final String PHP_CLIENT = "Nacos-Php-Client";
|
||||
|
||||
public static final String CSHARP_CLIENT = "Nacos-CSharp-Client";
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user