Commit 32b3ca41 by Dave Syer

Set registration retries to non-zero by default if peered

parent aa2d0eb4
...@@ -21,16 +21,15 @@ import java.util.HashMap; ...@@ -21,16 +21,15 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import com.netflix.eureka.aws.AwsBindingStrategy;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.netflix.eureka.EurekaConstants;
import org.springframework.core.env.PropertyResolver;
import com.netflix.eureka.EurekaServerConfig; import com.netflix.eureka.EurekaServerConfig;
import com.netflix.eureka.aws.AwsBindingStrategy;
import org.springframework.cloud.netflix.eureka.EurekaConstants; import lombok.Data;
import org.springframework.core.env.PropertyResolver;
/** /**
* @author Dave Syer * @author Dave Syer
...@@ -90,7 +89,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan ...@@ -90,7 +89,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
private long aSGUpdateIntervalMs = 5 * MINUTES; private long aSGUpdateIntervalMs = 5 * MINUTES;
private long aSGCacheExpiryTimeoutMs = 10 * MINUTES; // defaults to longer than the asg update interval private long aSGCacheExpiryTimeoutMs = 10 * MINUTES; // defaults to longer than the
// asg update interval
private long responseCacheAutoExpirationInSeconds = 180; private long responseCacheAutoExpirationInSeconds = 180;
...@@ -110,7 +110,6 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan ...@@ -110,7 +110,6 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
private boolean syncWhenTimestampDiffers = true; private boolean syncWhenTimestampDiffers = true;
//TODO: what should these defaults be? for single first?
private int registrySyncRetries = 0; private int registrySyncRetries = 0;
private long registrySyncRetryWaitMs = 30 * 1000; private long registrySyncRetryWaitMs = 30 * 1000;
...@@ -221,8 +220,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan ...@@ -221,8 +220,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
@Override @Override
public Set<String> getRemoteRegionAppWhitelist(String regionName) { public Set<String> getRemoteRegionAppWhitelist(String regionName) {
return this.remoteRegionAppWhitelist.get(regionName == null ? "global" return this.remoteRegionAppWhitelist
: regionName.trim().toLowerCase()); .get(regionName == null ? "global" : regionName.trim().toLowerCase());
} }
@Override @Override
...@@ -242,12 +241,12 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan ...@@ -242,12 +241,12 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
@Override @Override
public String getJsonCodecName() { public String getJsonCodecName() {
return jsonCodecName; return this.jsonCodecName;
} }
@Override @Override
public String getXmlCodecName() { public String getXmlCodecName() {
return xmlCodecName; return this.xmlCodecName;
} }
@Override @Override
...@@ -262,8 +261,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan ...@@ -262,8 +261,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
@Override @Override
public String getExperimental(String name) { public String getExperimental(String name) {
if (propertyResolver != null) { if (this.propertyResolver != null) {
return propertyResolver.getProperty(PREFIX + ".experimental." + name, return this.propertyResolver.getProperty(PREFIX + ".experimental." + name,
String.class, null); String.class, null);
} }
return null; return null;
......
...@@ -109,8 +109,13 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter { ...@@ -109,8 +109,13 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter {
protected static class EurekaServerConfigBeanConfiguration { protected static class EurekaServerConfigBeanConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public EurekaServerConfig eurekaServerConfig() { public EurekaServerConfig eurekaServerConfig(EurekaClientConfig clientConfig) {
return new EurekaServerConfigBean(); EurekaServerConfigBean server = new EurekaServerConfigBean();
if (clientConfig.shouldRegisterWithEureka()) {
// Set a sensible default if we are supposed to replicate
server.setRegistrySyncRetries(5);
}
return server;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment